@lobehub/ui 1.170.5 → 1.170.7
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 +20 -12
- package/es/Modal/index.js +56 -45
- package/es/Modal/style.js +1 -1
- package/es/styles/theme/customToken.js +6 -2
- package/es/types/customToken.d.ts +1 -0
- 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,
|
|
@@ -100,7 +102,7 @@ var Drawer = /*#__PURE__*/memo(function (_ref) {
|
|
|
100
102
|
padding: '0 4px'
|
|
101
103
|
}, styles === null || styles === void 0 ? void 0 : styles.body),
|
|
102
104
|
content: _objectSpread({
|
|
103
|
-
background: sidebar ? "linear-gradient(to right, ".concat(theme.
|
|
105
|
+
background: sidebar ? "linear-gradient(to right, ".concat(theme.colorBgLayout, " 49.9%, ").concat(theme.colorBgContainer, " 50%)") : theme.colorBgContainer
|
|
104
106
|
}, styles === null || styles === void 0 ? void 0 : styles.content),
|
|
105
107
|
header: _objectSpread({
|
|
106
108
|
background: 'transparent',
|
|
@@ -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: {
|
|
146
|
-
background: theme.
|
|
148
|
+
style: _objectSpread({
|
|
149
|
+
background: theme.colorBgLayout,
|
|
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: {
|
|
157
|
-
background: theme.
|
|
158
|
-
height: '100%'
|
|
159
|
-
|
|
162
|
+
style: _objectSpread({
|
|
163
|
+
background: theme.colorBgContainer,
|
|
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]
|
package/es/Modal/index.js
CHANGED
|
@@ -20,7 +20,6 @@ import { Modal as AntModal, Button, ConfigProvider, Drawer } from 'antd';
|
|
|
20
20
|
import { useResponsive } from 'antd-style';
|
|
21
21
|
import { isNumber } from 'lodash-es';
|
|
22
22
|
import { Maximize2, Minimize2, X } from 'lucide-react';
|
|
23
|
-
import { lighten } from 'polished';
|
|
24
23
|
import { memo, useState } from 'react';
|
|
25
24
|
import ActionIcon from "../ActionIcon";
|
|
26
25
|
import Icon from "../Icon";
|
|
@@ -71,57 +70,69 @@ var Modal = /*#__PURE__*/memo(function (_ref) {
|
|
|
71
70
|
var body = stylesProps.body,
|
|
72
71
|
restStyles = _objectWithoutProperties(stylesProps, _excluded2);
|
|
73
72
|
var hideFooter = footer === false || footer === null;
|
|
74
|
-
if (enableResponsive && mobile) return /*#__PURE__*/_jsx(
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
}),
|
|
79
|
-
destroyOnClose: destroyOnClose,
|
|
80
|
-
extra: allowFullscreen && /*#__PURE__*/_jsx(ActionIcon, {
|
|
81
|
-
icon: fullscreen ? Minimize2 : Maximize2,
|
|
82
|
-
onClick: function onClick() {
|
|
83
|
-
return setFullscreen(!fullscreen);
|
|
73
|
+
if (enableResponsive && mobile) return /*#__PURE__*/_jsx(ConfigProvider, {
|
|
74
|
+
theme: {
|
|
75
|
+
token: {
|
|
76
|
+
colorBgElevated: theme.colorBgContainer
|
|
84
77
|
}
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
children:
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
78
|
+
},
|
|
79
|
+
children: /*#__PURE__*/_jsx(Drawer, _objectSpread(_objectSpread({
|
|
80
|
+
className: cx(styles.drawerContent, className),
|
|
81
|
+
closeIcon: /*#__PURE__*/_jsx(ActionIcon, {
|
|
82
|
+
icon: X
|
|
83
|
+
}),
|
|
84
|
+
destroyOnClose: destroyOnClose,
|
|
85
|
+
extra: allowFullscreen && /*#__PURE__*/_jsx(ActionIcon, {
|
|
86
|
+
icon: fullscreen ? Minimize2 : Maximize2,
|
|
87
|
+
onClick: function onClick() {
|
|
88
|
+
return setFullscreen(!fullscreen);
|
|
89
|
+
}
|
|
90
|
+
}),
|
|
91
|
+
footer: hideFooter ? null : footer || /*#__PURE__*/_jsxs(_Fragment, {
|
|
92
|
+
children: [/*#__PURE__*/_jsx(Button, _objectSpread(_objectSpread({
|
|
93
|
+
color: 'default',
|
|
94
|
+
onClick: onCancel,
|
|
95
|
+
variant: 'filled'
|
|
96
|
+
}, cancelButtonProps), {}, {
|
|
97
|
+
children: cancelText || 'Cancel'
|
|
98
|
+
})), /*#__PURE__*/_jsx(Button, _objectSpread(_objectSpread({
|
|
99
|
+
loading: confirmLoading,
|
|
100
|
+
onClick: onOk,
|
|
101
|
+
type: "primary"
|
|
102
|
+
}, okButtonProps), {}, {
|
|
103
|
+
style: _objectSpread({
|
|
104
|
+
marginInlineStart: 8
|
|
105
|
+
}, okButtonProps === null || okButtonProps === void 0 ? void 0 : okButtonProps.style),
|
|
106
|
+
children: okText || 'OK'
|
|
107
|
+
}))]
|
|
108
|
+
}),
|
|
109
|
+
height: fullscreen ? 'calc(100% - env(safe-area-inset-top))' : maxHeight || '75vh',
|
|
110
|
+
maskClassName: cx(styles.wrap, wrapClassName),
|
|
111
|
+
onClose: onCancel,
|
|
112
|
+
open: open,
|
|
113
|
+
placement: 'bottom',
|
|
114
|
+
styles: _objectSpread({
|
|
115
|
+
body: _objectSpread({
|
|
116
|
+
paddingBlock: "16px ".concat(footer ? 0 : '16px'),
|
|
117
|
+
paddingInline: (_paddings$desktop = paddings === null || paddings === void 0 ? void 0 : paddings.desktop) !== null && _paddings$desktop !== void 0 ? _paddings$desktop : 16
|
|
118
|
+
}, body)
|
|
119
|
+
}, restStyles),
|
|
120
|
+
title: title
|
|
121
|
+
}, rest), {}, {
|
|
122
|
+
children: children
|
|
123
|
+
}))
|
|
124
|
+
});
|
|
117
125
|
return /*#__PURE__*/_jsx(ConfigProvider, {
|
|
118
126
|
theme: {
|
|
119
127
|
token: {
|
|
120
|
-
colorBgElevated:
|
|
128
|
+
colorBgElevated: theme.colorBgContainer
|
|
121
129
|
}
|
|
122
130
|
},
|
|
123
131
|
children: /*#__PURE__*/_jsx(AntModal, _objectSpread(_objectSpread({
|
|
124
|
-
cancelButtonProps:
|
|
132
|
+
cancelButtonProps: _objectSpread({
|
|
133
|
+
color: 'default',
|
|
134
|
+
variant: 'filled'
|
|
135
|
+
}, cancelButtonProps),
|
|
125
136
|
cancelText: cancelText,
|
|
126
137
|
className: cx(styles.content, className),
|
|
127
138
|
closable: true,
|
package/es/Modal/style.js
CHANGED
|
@@ -11,7 +11,7 @@ export var useStyles = createStyles(function (_ref, _ref2) {
|
|
|
11
11
|
var maxHeight = _ref2.maxHeight;
|
|
12
12
|
return {
|
|
13
13
|
content: cx(maxHeight && css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .", "-modal-body {\n overflow: auto;\n max-height: ", ";\n }\n "])), prefixCls, maxHeight), css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n .", "-modal-footer {\n margin: 0;\n padding: 16px;\n }\n .", "-modal-header {\n display: flex;\n gap: 4px;\n align-items: center;\n justify-content: center;\n\n height: 56px;\n margin-block-end: 0;\n padding: 16px;\n }\n .", "-modal-content {\n overflow: hidden;\n padding: 0;\n border: 1px solid ", ";\n border-radius: ", "px;\n }\n "])), prefixCls, prefixCls, prefixCls, token.colorSplit, token.borderRadiusLG)),
|
|
14
|
-
drawerContent: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n
|
|
14
|
+
drawerContent: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n .", "-drawer-close {\n padding: 0;\n }\n\n .", "-drawer-header {\n flex: none;\n height: ", "px !important;\n padding-block: 0;\n padding-inline: 16px;\n }\n\n .", "-drawer-footer {\n display: flex;\n align-items: center;\n justify-content: flex-end;\n\n padding: 16px;\n\n border: none;\n }\n "])), prefixCls, prefixCls, HEADER_HEIGHT, prefixCls),
|
|
15
15
|
wrap: css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n overflow: hidden auto;\n "])))
|
|
16
16
|
};
|
|
17
17
|
});
|
|
@@ -12,6 +12,7 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
|
|
|
12
12
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
13
13
|
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); }
|
|
14
14
|
import { camelCase } from 'lodash-es';
|
|
15
|
+
import { mix } from 'polished';
|
|
15
16
|
import { colorScales } from "../../color/colors";
|
|
16
17
|
var generateColorPalette = function generateColorPalette(_ref) {
|
|
17
18
|
var _ref2;
|
|
@@ -62,7 +63,8 @@ var generateCustomColorPalette = function generateCustomColorPalette(_ref3) {
|
|
|
62
63
|
}));
|
|
63
64
|
};
|
|
64
65
|
export var generateCustomToken = function generateCustomToken(_ref4) {
|
|
65
|
-
var isDarkMode = _ref4.isDarkMode
|
|
66
|
+
var isDarkMode = _ref4.isDarkMode,
|
|
67
|
+
token = _ref4.token;
|
|
66
68
|
var colorCustomToken = {};
|
|
67
69
|
for (var _i = 0, _Object$entries = Object.entries(colorScales); _i < _Object$entries.length; _i++) {
|
|
68
70
|
var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2),
|
|
@@ -74,5 +76,7 @@ export var generateCustomToken = function generateCustomToken(_ref4) {
|
|
|
74
76
|
scale: scale
|
|
75
77
|
}));
|
|
76
78
|
}
|
|
77
|
-
return colorCustomToken
|
|
79
|
+
return _objectSpread(_objectSpread({}, colorCustomToken), {}, {
|
|
80
|
+
colorBgContainerSecondary: mix(0.5, token.colorBgLayout, token.colorBgContainer)
|
|
81
|
+
});
|
|
78
82
|
};
|