@lobehub/ui 1.170.4 → 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/ColorSwatches/index.js +5 -3
- package/es/ColorSwatches/style.d.ts +1 -0
- package/es/ColorSwatches/style.js +5 -4
- package/es/Drawer/index.d.ts +6 -0
- package/es/Drawer/index.js +17 -9
- package/es/Form/components/FormSubmitFooter.d.ts +2 -2
- package/es/Form/components/FormSubmitFooter.js +3 -7
- package/package.json +1 -1
|
@@ -16,6 +16,7 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
16
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
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
18
|
import { ColorPicker } from 'antd';
|
|
19
|
+
import chroma from 'chroma-js';
|
|
19
20
|
import { CheckIcon } from 'lucide-react';
|
|
20
21
|
import { readableColor, rgba } from 'polished';
|
|
21
22
|
import { memo } from 'react';
|
|
@@ -57,7 +58,7 @@ var ColorSwatches = /*#__PURE__*/memo(function (_ref) {
|
|
|
57
58
|
return c.color === active;
|
|
58
59
|
});
|
|
59
60
|
return /*#__PURE__*/_jsxs(Flexbox, _objectSpread(_objectSpread({
|
|
60
|
-
gap:
|
|
61
|
+
gap: 6,
|
|
61
62
|
horizontal: true,
|
|
62
63
|
style: _objectSpread({
|
|
63
64
|
flexWrap: 'wrap'
|
|
@@ -66,15 +67,16 @@ var ColorSwatches = /*#__PURE__*/memo(function (_ref) {
|
|
|
66
67
|
children: [enableColorSwatches && colors.map(function (c) {
|
|
67
68
|
var color = c.color || theme.colorPrimary;
|
|
68
69
|
var isActive = !active && !c.color || color === active;
|
|
70
|
+
var isTransparent = c.color === 'transparent' || chroma(c.color).alpha() === 0;
|
|
69
71
|
return /*#__PURE__*/_jsx(Tooltip, {
|
|
70
72
|
title: c.label,
|
|
71
73
|
children: /*#__PURE__*/_jsx(Center, {
|
|
72
|
-
className: cx(styles.container, isActive && styles.active),
|
|
74
|
+
className: cx(styles.container, isTransparent && styles.transparent, isActive && styles.active),
|
|
73
75
|
onClick: function onClick() {
|
|
74
76
|
return setActive(c.color || undefined);
|
|
75
77
|
},
|
|
76
78
|
style: {
|
|
77
|
-
background: color,
|
|
79
|
+
background: isTransparent ? undefined : color,
|
|
78
80
|
borderRadius: shape === 'circle' ? '50%' : theme.borderRadius
|
|
79
81
|
},
|
|
80
82
|
children: isActive && /*#__PURE__*/_jsx(Icon, {
|
|
@@ -3,4 +3,5 @@ export declare const useStyles: (props?: number | undefined) => import("antd-sty
|
|
|
3
3
|
conic: import("antd-style").SerializedStyles;
|
|
4
4
|
container: import("antd-style").SerializedStyles;
|
|
5
5
|
picker: import("antd-style").SerializedStyles;
|
|
6
|
+
transparent: import("antd-style").SerializedStyles;
|
|
6
7
|
}>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
1
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
|
|
2
2
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
3
3
|
import { createStyles } from 'antd-style';
|
|
4
4
|
export var useStyles = createStyles(function (_ref, size) {
|
|
@@ -6,9 +6,10 @@ export var useStyles = createStyles(function (_ref, size) {
|
|
|
6
6
|
token = _ref.token,
|
|
7
7
|
prefixCls = _ref.prefixCls;
|
|
8
8
|
return {
|
|
9
|
-
active: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n box-shadow: inset 0 0 0 1px
|
|
9
|
+
active: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n box-shadow: inset 0 0 0 1px ", ";\n "])), token.colorFill),
|
|
10
10
|
conic: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n background: conic-gradient(\n ", ",\n ", ",\n ", ",\n ", ",\n ", ",\n ", ",\n ", ",\n ", ",\n ", ",\n ", ",\n ", ",\n ", ",\n ", "\n );\n .", "-color-picker-color-block {\n opacity: 0;\n }\n "])), token.red, token.volcano, token.orange, token.gold, token.yellow, token.lime, token.green, token.cyan, token.blue, token.geekblue, token.purple, token.magenta, token.red, prefixCls),
|
|
11
|
-
container: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n cursor: pointer;\n\n flex: none;\n\n width: ", "px;\n min-width: ", "px;\n height: ", "px;\n min-height: ", "px;\n\n background: ", ";\n box-shadow: inset 0 0 0 1px
|
|
12
|
-
picker: css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n overflow: hidden;\n flex: none;\n\n width: ", "px;\n min-width: ", "px;\n height: ", "px;\n min-height: ", "px;\n padding: 0;\n\n border: none;\n box-shadow: inset 0 0 0 1px
|
|
11
|
+
container: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n cursor: pointer;\n\n flex: none;\n\n width: ", "px;\n min-width: ", "px;\n height: ", "px;\n min-height: ", "px;\n\n background: ", ";\n box-shadow: inset 0 0 0 1px ", ";\n\n &:hover {\n box-shadow:\n inset 0 0 0 1px rgba(0, 0, 0, 5%),\n 0 0 0 2px ", ";\n }\n "])), size, size, size, size, token.colorBgContainer, token.colorFillSecondary, token.colorText),
|
|
12
|
+
picker: css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n overflow: hidden;\n flex: none;\n\n width: ", "px;\n min-width: ", "px;\n height: ", "px;\n min-height: ", "px;\n padding: 0;\n\n border: none;\n box-shadow: inset 0 0 0 1px ", ";\n\n &:hover {\n box-shadow:\n inset 0 0 0 1px ", ",\n 0 0 0 2px ", ";\n }\n\n .", "-color-picker-color-block {\n width: 100%;\n height: 100%;\n border: none;\n border-radius: inherit;\n }\n "])), size, size, size, size, token.colorFillSecondary, token.colorFillSecondary, token.colorText, prefixCls),
|
|
13
|
+
transparent: css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n background-image: conic-gradient(\n ", " 25%,\n transparent 25% 50%,\n ", " 50% 75%,\n transparent 75% 100%\n );\n background-size: 50% 50%;\n "])), token.colorFillSecondary, token.colorFillSecondary)
|
|
13
14
|
};
|
|
14
15
|
});
|
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]
|
|
@@ -9,10 +9,10 @@ export interface FormSubmitFooterProps extends FlexboxProps {
|
|
|
9
9
|
float?: boolean;
|
|
10
10
|
onReset?: () => void;
|
|
11
11
|
resetButtonProps?: Omit<ButtonProps, 'children'>;
|
|
12
|
-
resetText?: ReactNode;
|
|
13
12
|
saveButtonProps?: Omit<ButtonProps, 'children'>;
|
|
14
|
-
saveText?: ReactNode;
|
|
15
13
|
texts?: {
|
|
14
|
+
reset?: string;
|
|
15
|
+
submit?: string;
|
|
16
16
|
unSaved?: string;
|
|
17
17
|
unSavedWarning?: string;
|
|
18
18
|
};
|
|
@@ -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 _excluded = ["enableReset", "buttonProps", "float", "
|
|
2
|
+
var _excluded = ["enableReset", "buttonProps", "float", "onReset", "saveButtonProps", "resetButtonProps", "enableUnsavedWarning", "children", "texts", "className"];
|
|
3
3
|
var _templateObject, _templateObject2;
|
|
4
4
|
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; }
|
|
5
5
|
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; }
|
|
@@ -42,10 +42,6 @@ var FormSubmitFooter = /*#__PURE__*/memo(function (_ref2) {
|
|
|
42
42
|
enableReset = _ref2$enableReset === void 0 ? true : _ref2$enableReset,
|
|
43
43
|
buttonProps = _ref2.buttonProps,
|
|
44
44
|
float = _ref2.float,
|
|
45
|
-
_ref2$saveText = _ref2.saveText,
|
|
46
|
-
saveText = _ref2$saveText === void 0 ? 'Submit' : _ref2$saveText,
|
|
47
|
-
_ref2$resetText = _ref2.resetText,
|
|
48
|
-
resetText = _ref2$resetText === void 0 ? 'Reset' : _ref2$resetText,
|
|
49
45
|
onReset = _ref2.onReset,
|
|
50
46
|
saveButtonProps = _ref2.saveButtonProps,
|
|
51
47
|
resetButtonProps = _ref2.resetButtonProps,
|
|
@@ -119,14 +115,14 @@ var FormSubmitFooter = /*#__PURE__*/memo(function (_ref2) {
|
|
|
119
115
|
shape: float ? 'round' : undefined,
|
|
120
116
|
variant: 'filled'
|
|
121
117
|
}, buttonProps), resetButtonProps), {}, {
|
|
122
|
-
children:
|
|
118
|
+
children: (texts === null || texts === void 0 ? void 0 : texts.reset) || 'Reset'
|
|
123
119
|
})), /*#__PURE__*/_jsx(Button, _objectSpread(_objectSpread(_objectSpread({
|
|
124
120
|
htmlType: "submit",
|
|
125
121
|
loading: submitLoading,
|
|
126
122
|
shape: float ? 'round' : undefined,
|
|
127
123
|
type: "primary"
|
|
128
124
|
}, buttonProps), saveButtonProps), {}, {
|
|
129
|
-
children:
|
|
125
|
+
children: (texts === null || texts === void 0 ? void 0 : texts.submit) || 'Submit'
|
|
130
126
|
}))]
|
|
131
127
|
});
|
|
132
128
|
if (!float) return /*#__PURE__*/_jsx(Flexbox, _objectSpread(_objectSpread({
|