@lobehub/ui 2.18.2 → 2.18.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.
- package/es/Accordion/Accordion.js +13 -6
- package/es/EmojiPicker/EmojiPicker.js +14 -7
- package/es/EmojiPicker/style.d.ts +1 -0
- package/es/EmojiPicker/style.js +3 -2
- package/es/EmojiPicker/type.d.ts +2 -0
- package/es/ThemeProvider/ConfigProvider.d.ts +5 -0
- package/es/ThemeProvider/ConfigProvider.js +41 -0
- package/es/ThemeProvider/ThemeProvider.js +12 -9
- package/package.json +1 -1
|
@@ -34,8 +34,7 @@ var Accordion = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (_ref, ref)
|
|
|
34
34
|
userStyle = _ref.style,
|
|
35
35
|
_ref$accordion = _ref.accordion,
|
|
36
36
|
accordion = _ref$accordion === void 0 ? false : _ref$accordion,
|
|
37
|
-
|
|
38
|
-
defaultExpandedKeys = _ref$defaultExpandedK === void 0 ? [] : _ref$defaultExpandedK,
|
|
37
|
+
defaultExpandedKeys = _ref.defaultExpandedKeys,
|
|
39
38
|
expandedKeysProp = _ref.expandedKeys,
|
|
40
39
|
onExpandedChange = _ref.onExpandedChange,
|
|
41
40
|
_ref$variant = _ref.variant,
|
|
@@ -58,7 +57,18 @@ var Accordion = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (_ref, ref)
|
|
|
58
57
|
var _useStyles = useStyles(),
|
|
59
58
|
cx = _useStyles.cx,
|
|
60
59
|
styles = _useStyles.styles;
|
|
61
|
-
|
|
60
|
+
|
|
61
|
+
// Convert children to array and filter valid elements
|
|
62
|
+
var validChildren = Children.toArray(children).filter(isValidElement);
|
|
63
|
+
|
|
64
|
+
// Collect all item keys
|
|
65
|
+
var allItemKeys = validChildren.map(function (child, index) {
|
|
66
|
+
return child.props.itemKey || index;
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
// If defaultExpandedKeys or expandedKeys is undefined, expand all items by default
|
|
70
|
+
var initialExpandedKeys = defaultExpandedKeys !== null && defaultExpandedKeys !== void 0 ? defaultExpandedKeys : allItemKeys;
|
|
71
|
+
var _useMergeState = useMergeState(initialExpandedKeys, {
|
|
62
72
|
onChange: onExpandedChange,
|
|
63
73
|
value: expandedKeysProp
|
|
64
74
|
}),
|
|
@@ -92,9 +102,6 @@ var Accordion = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (_ref, ref)
|
|
|
92
102
|
showDivider: showDivider,
|
|
93
103
|
variant: variant
|
|
94
104
|
};
|
|
95
|
-
|
|
96
|
-
// Convert children to array and filter valid elements
|
|
97
|
-
var validChildren = Children.toArray(children).filter(isValidElement);
|
|
98
105
|
var content = /*#__PURE__*/_jsx(_Fragment, {
|
|
99
106
|
children: validChildren.map(function (child, index) {
|
|
100
107
|
// Extract itemKey from child props to use as React key
|
|
@@ -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 = ["value", "defaultAvatar", "onChange", "locale", "allowUpload", "allowDelete", "texts", "onDelete", "compressSize", "customEmojis", "className", "loading", "onUpload", "customTabs", "popupClassName", "popupStyle", "customRender", "open", "defaultOpen", "onOpenChange"];
|
|
4
|
+
var _excluded = ["value", "defaultAvatar", "onChange", "locale", "allowUpload", "allowDelete", "texts", "onDelete", "compressSize", "customEmojis", "className", "loading", "onUpload", "customTabs", "popupClassName", "popupStyle", "customRender", "open", "defaultOpen", "onOpenChange", "popupProps"];
|
|
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; }
|
|
@@ -66,6 +66,7 @@ var EmojiPicker = /*#__PURE__*/memo(function (_ref) {
|
|
|
66
66
|
_ref$defaultOpen = _ref.defaultOpen,
|
|
67
67
|
defaultOpen = _ref$defaultOpen === void 0 ? false : _ref$defaultOpen,
|
|
68
68
|
onOpenChange = _ref.onOpenChange,
|
|
69
|
+
popupProps = _ref.popupProps,
|
|
69
70
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
70
71
|
var ref = useRef(null);
|
|
71
72
|
var _useMergeState = useMergeState(defaultOpen, {
|
|
@@ -154,6 +155,7 @@ var EmojiPicker = /*#__PURE__*/memo(function (_ref) {
|
|
|
154
155
|
}, popupStyle),
|
|
155
156
|
children: [showTabs && /*#__PURE__*/_jsxs(Flexbox, {
|
|
156
157
|
align: 'center',
|
|
158
|
+
className: styles.tabs,
|
|
157
159
|
horizontal: true,
|
|
158
160
|
justify: 'space-between',
|
|
159
161
|
paddingInline: 10,
|
|
@@ -163,14 +165,18 @@ var EmojiPicker = /*#__PURE__*/memo(function (_ref) {
|
|
|
163
165
|
items: items,
|
|
164
166
|
onChange: function onChange(key) {
|
|
165
167
|
return setTab(key);
|
|
166
|
-
}
|
|
168
|
+
},
|
|
169
|
+
size: 'small'
|
|
167
170
|
}), allowDelete && /*#__PURE__*/_jsx(ActionIcon, {
|
|
168
171
|
icon: TrashIcon,
|
|
169
172
|
onClick: function onClick() {
|
|
170
173
|
handleAvatarChange(defaultAvatar);
|
|
171
174
|
onDelete === null || onDelete === void 0 || onDelete();
|
|
172
175
|
},
|
|
173
|
-
size:
|
|
176
|
+
size: {
|
|
177
|
+
blockSize: 32,
|
|
178
|
+
size: 18
|
|
179
|
+
},
|
|
174
180
|
title: (texts === null || texts === void 0 ? void 0 : texts.delete) || 'Delete'
|
|
175
181
|
})]
|
|
176
182
|
}), tab === 'emoji' && /*#__PURE__*/_jsx(Picker, {
|
|
@@ -198,7 +204,7 @@ var EmojiPicker = /*#__PURE__*/memo(function (_ref) {
|
|
|
198
204
|
}, item.value);
|
|
199
205
|
})]
|
|
200
206
|
});
|
|
201
|
-
return /*#__PURE__*/_jsx(Popover, {
|
|
207
|
+
return /*#__PURE__*/_jsx(Popover, _objectSpread(_objectSpread({
|
|
202
208
|
arrow: false,
|
|
203
209
|
content: content,
|
|
204
210
|
defaultOpen: defaultOpen,
|
|
@@ -207,15 +213,16 @@ var EmojiPicker = /*#__PURE__*/memo(function (_ref) {
|
|
|
207
213
|
setVisible(v);
|
|
208
214
|
},
|
|
209
215
|
open: visible,
|
|
210
|
-
placement: '
|
|
216
|
+
placement: 'bottom',
|
|
211
217
|
rootClassName: styles.popover,
|
|
212
|
-
trigger: ['click']
|
|
218
|
+
trigger: ['click']
|
|
219
|
+
}, popupProps), {}, {
|
|
213
220
|
children: customRender ? customRender(ava) : /*#__PURE__*/_jsx(Avatar, _objectSpread({
|
|
214
221
|
avatar: ava,
|
|
215
222
|
className: cx(styles.root, className),
|
|
216
223
|
loading: loading
|
|
217
224
|
}, rest))
|
|
218
|
-
});
|
|
225
|
+
}));
|
|
219
226
|
});
|
|
220
227
|
EmojiPicker.displayName = 'EmojiPicker';
|
|
221
228
|
export default EmojiPicker;
|
|
@@ -3,4 +3,5 @@ export declare const useStyles: (props?: unknown) => import("antd-style").Return
|
|
|
3
3
|
picker: import("antd-style").SerializedStyles;
|
|
4
4
|
popover: import("antd-style").SerializedStyles;
|
|
5
5
|
root: import("antd-style").SerializedStyles;
|
|
6
|
+
tabs: import("antd-style").SerializedStyles;
|
|
6
7
|
}>;
|
package/es/EmojiPicker/style.js
CHANGED
|
@@ -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
|
import chroma from 'chroma-js';
|
|
@@ -10,6 +10,7 @@ export var useStyles = createStyles(function (_ref) {
|
|
|
10
10
|
editor: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n overflow: hidden;\n border: 1px solid ", ";\n border-radius: ", "px;\n "])), token.colorBorder, token.borderRadiusLG),
|
|
11
11
|
picker: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n position: relative;\n\n em-emoji-picker {\n --rgb-accent: ", ";\n --shadow: none;\n --rgb-background: ", ";\n --border-radius: 0;\n }\n "])), chroma(token.colorPrimary).rgb().join(','), chroma(token.colorBgElevated).rgb().join(',')),
|
|
12
12
|
popover: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n .", "-popover-inner {\n overflow: hidden;\n padding: 0;\n }\n "])), prefixCls),
|
|
13
|
-
root: css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n position: relative;\n transition:
|
|
13
|
+
root: css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n position: relative;\n transition: background 150ms ", ";\n\n &:hover {\n background: ", ";\n }\n "])), token.motionEaseOut, token.colorFillSecondary),
|
|
14
|
+
tabs: css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n border-block-end: 1px solid ", ";\n\n .ant-tabs-tab {\n display: flex;\n align-items: center;\n justify-content: center;\n\n width: 32px;\n height: 32px;\n padding: 0 !important;\n }\n "])), token.colorBorderSecondary)
|
|
14
15
|
};
|
|
15
16
|
});
|
package/es/EmojiPicker/type.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { PopoverProps } from 'antd';
|
|
1
2
|
import { CSSProperties, ReactNode } from 'react';
|
|
2
3
|
import type { AvatarProps } from "../Avatar/type";
|
|
3
4
|
import type { AvatarUploaderProps } from "./AvatarUploader";
|
|
@@ -37,6 +38,7 @@ export interface EmojiPickerProps extends Omit<AvatarProps, 'onChange' | 'avatar
|
|
|
37
38
|
onUpload?: AvatarUploaderProps['onUpload'];
|
|
38
39
|
open?: boolean;
|
|
39
40
|
popupClassName?: string;
|
|
41
|
+
popupProps?: Omit<PopoverProps, 'onOpenChange' | 'defaultOpen' | 'content' | 'open' | 'rootClassName' | 'trigger'>;
|
|
40
42
|
popupStyle?: CSSProperties;
|
|
41
43
|
size?: number;
|
|
42
44
|
texts?: AvatarUploaderProps['texts'] & {
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { ConfigProvider as AntdConfigProvider } from 'antd';
|
|
4
|
+
import { useTheme } from 'antd-style';
|
|
5
|
+
import { memo } from 'react';
|
|
6
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
+
var ConfigProvider = /*#__PURE__*/memo(function (_ref) {
|
|
8
|
+
var children = _ref.children;
|
|
9
|
+
var theme = useTheme();
|
|
10
|
+
return /*#__PURE__*/_jsx(AntdConfigProvider, {
|
|
11
|
+
theme: {
|
|
12
|
+
components: {
|
|
13
|
+
Button: {
|
|
14
|
+
contentFontSizeSM: 12
|
|
15
|
+
},
|
|
16
|
+
DatePicker: {
|
|
17
|
+
activeBorderColor: theme.colorBorder,
|
|
18
|
+
hoverBorderColor: theme.colorBorder
|
|
19
|
+
},
|
|
20
|
+
Input: {
|
|
21
|
+
activeBorderColor: theme.colorBorder,
|
|
22
|
+
hoverBorderColor: theme.colorBorder
|
|
23
|
+
},
|
|
24
|
+
InputNumber: {
|
|
25
|
+
activeBorderColor: theme.colorBorder,
|
|
26
|
+
hoverBorderColor: theme.colorBorder
|
|
27
|
+
},
|
|
28
|
+
Mentions: {
|
|
29
|
+
activeBorderColor: theme.colorBorder,
|
|
30
|
+
hoverBorderColor: theme.colorBorder
|
|
31
|
+
},
|
|
32
|
+
Select: {
|
|
33
|
+
activeBorderColor: theme.colorBorder,
|
|
34
|
+
hoverBorderColor: theme.colorBorder
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
children: children
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
export default ConfigProvider;
|
|
@@ -17,6 +17,7 @@ import { useCdnFn } from "../ConfigProvider";
|
|
|
17
17
|
import FontLoader from "../FontLoader";
|
|
18
18
|
import { lobeCustomStylish, lobeCustomToken } from "../styles";
|
|
19
19
|
import { createLobeAntdTheme } from "../styles/theme/antdTheme";
|
|
20
|
+
import ConfigProvider from "./ConfigProvider";
|
|
20
21
|
import GlobalStyle from "./GlobalStyle";
|
|
21
22
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
22
23
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -71,19 +72,21 @@ var ThemeProvider = /*#__PURE__*/memo(function (_ref) {
|
|
|
71
72
|
return /*#__PURE__*/_jsx(FontLoader, {
|
|
72
73
|
url: webfont
|
|
73
74
|
}, webfont);
|
|
74
|
-
}), /*#__PURE__*/
|
|
75
|
+
}), /*#__PURE__*/_jsx(AntdThemeProvider, _objectSpread(_objectSpread({
|
|
75
76
|
customStylish: stylish,
|
|
76
77
|
customToken: token,
|
|
77
78
|
theme: theme
|
|
78
79
|
}, rest), {}, {
|
|
79
|
-
children:
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
80
|
+
children: /*#__PURE__*/_jsxs(ConfigProvider, {
|
|
81
|
+
children: [enableGlobalStyle && /*#__PURE__*/_jsx(GlobalStyle, {}), /*#__PURE__*/_jsx(App, {
|
|
82
|
+
className: className,
|
|
83
|
+
style: _objectSpread({
|
|
84
|
+
minHeight: 'inherit',
|
|
85
|
+
width: 'inherit'
|
|
86
|
+
}, style),
|
|
87
|
+
children: children
|
|
88
|
+
})]
|
|
89
|
+
})
|
|
87
90
|
}))]
|
|
88
91
|
});
|
|
89
92
|
});
|