@oceanbase/design 0.4.12 → 0.4.14
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/dist/design.min.js +1 -1
- package/es/anchor/index.d.ts +1 -0
- package/es/anchor/index.js +1 -0
- package/es/avatar/index.d.ts +1 -0
- package/es/avatar/index.js +1 -0
- package/es/modal/Modal.d.ts +5 -2
- package/es/modal/Modal.js +16 -3
- package/es/modal/style/index.js +10 -2
- package/es/segmented/index.d.ts +3 -0
- package/es/segmented/index.js +26 -7
- package/es/segmented/style/index.js +13 -2
- package/es/slider/style/index.js +9 -2
- package/es/table/index.d.ts +2 -2
- package/es/tabs/TabPane.d.ts +4 -0
- package/es/tabs/index.d.ts +4 -0
- package/es/tabs/index.js +19 -4
- package/es/tabs/style/index.js +10 -3
- package/es/tag/style/index.js +1 -3
- package/lib/anchor/index.d.ts +1 -0
- package/lib/anchor/index.js +2 -0
- package/lib/avatar/index.d.ts +1 -0
- package/lib/avatar/index.js +2 -0
- package/lib/modal/Modal.d.ts +5 -2
- package/lib/modal/Modal.js +9 -2
- package/lib/modal/style/index.js +11 -1
- package/lib/segmented/index.d.ts +3 -0
- package/lib/segmented/index.js +13 -3
- package/lib/segmented/style/index.js +26 -2
- package/lib/slider/style/index.js +5 -1
- package/lib/table/index.d.ts +2 -2
- package/lib/tabs/TabPane.d.ts +4 -0
- package/lib/tabs/index.d.ts +4 -0
- package/lib/tabs/index.js +15 -2
- package/lib/tabs/style/index.js +14 -1
- package/lib/tag/style/index.js +0 -1
- package/package.json +4 -4
package/lib/tabs/index.d.ts
CHANGED
|
@@ -2,15 +2,19 @@ import React from 'react';
|
|
|
2
2
|
import type { TabsProps as AntTabsProps, TabsPosition as AntTabsPosition } from 'antd/es/tabs';
|
|
3
3
|
import type { Tab as AntTab } from 'rc-tabs/es/interface';
|
|
4
4
|
import type { TabPaneProps } from './TabPane';
|
|
5
|
+
import type { BadgeProps } from '../badge';
|
|
5
6
|
export * from 'antd/es/tabs';
|
|
6
7
|
export type { TabPaneProps };
|
|
8
|
+
type BadgeType = BadgeProps | BadgeProps['count'];
|
|
7
9
|
export interface AntTabOptional extends Omit<AntTab, 'key' | 'label'> {
|
|
8
10
|
key?: string;
|
|
9
11
|
label?: React.ReactNode;
|
|
10
12
|
}
|
|
11
13
|
export type Tab = {
|
|
14
|
+
/** @deprecated please use `badge` instead */
|
|
12
15
|
tag?: React.ReactNode;
|
|
13
16
|
divider?: boolean;
|
|
17
|
+
badge?: BadgeType;
|
|
14
18
|
} & (AntTab | AntTabOptional);
|
|
15
19
|
export interface TabsProps extends Omit<AntTabsProps, 'items'> {
|
|
16
20
|
items?: Tab[];
|
package/lib/tabs/index.js
CHANGED
|
@@ -37,11 +37,15 @@ var import_util = require("@oceanbase/util");
|
|
|
37
37
|
var import_antd = require("antd");
|
|
38
38
|
var import_react = __toESM(require("react"));
|
|
39
39
|
var import_classnames = __toESM(require("classnames"));
|
|
40
|
+
var import_badge = __toESM(require("../badge"));
|
|
40
41
|
var import_config_provider = __toESM(require("../config-provider"));
|
|
41
42
|
var import_useLegacyItems = __toESM(require("./hooks/useLegacyItems"));
|
|
42
43
|
var import_style = __toESM(require("./style"));
|
|
43
44
|
var import_TabPane = __toESM(require("./TabPane"));
|
|
44
45
|
__reExport(tabs_exports, require("antd/es/tabs"), module.exports);
|
|
46
|
+
var isReactNode = (item) => {
|
|
47
|
+
return import_react.default.isValidElement(item);
|
|
48
|
+
};
|
|
45
49
|
var Tabs = ({
|
|
46
50
|
children,
|
|
47
51
|
items,
|
|
@@ -57,6 +61,15 @@ var Tabs = ({
|
|
|
57
61
|
const tabsCls = (0, import_classnames.default)(className);
|
|
58
62
|
const isHorizontal = !tabPosition || tabPosition === "top" || tabPosition === "bottom";
|
|
59
63
|
const dividerList = (items == null ? void 0 : items.filter((item) => item.divider)) || [];
|
|
64
|
+
const renderBadge = (0, import_react.useCallback)(
|
|
65
|
+
(badge) => {
|
|
66
|
+
if (typeof badge === "object" && !isReactNode(badge)) {
|
|
67
|
+
return /* @__PURE__ */ import_react.default.createElement(import_badge.default, { ...badge, className: (0, import_classnames.default)(`${prefixCls}-tab-badge`, badge.className) });
|
|
68
|
+
}
|
|
69
|
+
return /* @__PURE__ */ import_react.default.createElement(import_badge.default, { className: `${prefixCls}-tab-badge`, count: badge });
|
|
70
|
+
},
|
|
71
|
+
[prefixCls]
|
|
72
|
+
);
|
|
60
73
|
let newItems = (0, import_useLegacyItems.default)(items, children);
|
|
61
74
|
newItems = newItems == null ? void 0 : newItems.map((item) => {
|
|
62
75
|
if (!(0, import_util.isNullValue)(item.divider)) {
|
|
@@ -72,10 +85,10 @@ var Tabs = ({
|
|
|
72
85
|
),
|
|
73
86
|
disabled: true
|
|
74
87
|
};
|
|
75
|
-
} else if (!(0, import_util.isNullValue)(item.tag)) {
|
|
88
|
+
} else if (!(0, import_util.isNullValue)(item.tag) || !(0, import_util.isNullValue)(item.badge)) {
|
|
76
89
|
return {
|
|
77
90
|
...item,
|
|
78
|
-
label: /* @__PURE__ */ import_react.default.createElement(import_antd.Space, { size: 4 }, item.label, /* @__PURE__ */ import_react.default.createElement(import_antd.Tag, { bordered: false, className: `${prefixCls}-tab-tag` }, item.tag))
|
|
91
|
+
label: /* @__PURE__ */ import_react.default.createElement(import_antd.Space, { size: 4 }, item.label, item.badge && renderBadge(item.badge), !(0, import_util.isNullValue)(item.tag) && /* @__PURE__ */ import_react.default.createElement(import_antd.Tag, { bordered: false, className: `${prefixCls}-tab-tag` }, item.tag))
|
|
79
92
|
};
|
|
80
93
|
}
|
|
81
94
|
return item;
|
package/lib/tabs/style/index.js
CHANGED
|
@@ -25,7 +25,7 @@ __export(style_exports, {
|
|
|
25
25
|
module.exports = __toCommonJS(style_exports);
|
|
26
26
|
var import_genComponentStyleHook = require("../../_util/genComponentStyleHook");
|
|
27
27
|
var genTabsStyle = (token) => {
|
|
28
|
-
const { antCls, componentCls, colorInfo, colorInfoBg, colorTextSecondary } = token;
|
|
28
|
+
const { antCls, componentCls, colorInfo, colorInfoBg, colorTextSecondary, colorFillQuaternary } = token;
|
|
29
29
|
return {
|
|
30
30
|
[componentCls]: {
|
|
31
31
|
[`&${componentCls}-top, &${componentCls}-bottom`]: {
|
|
@@ -35,6 +35,7 @@ var genTabsStyle = (token) => {
|
|
|
35
35
|
}
|
|
36
36
|
},
|
|
37
37
|
[`${componentCls}-tab`]: {
|
|
38
|
+
/** @deprecated */
|
|
38
39
|
[`${componentCls}-tab-tag`]: {
|
|
39
40
|
color: colorTextSecondary,
|
|
40
41
|
fontFamily: "PingFangSC",
|
|
@@ -42,12 +43,24 @@ var genTabsStyle = (token) => {
|
|
|
42
43
|
borderRadius: 12,
|
|
43
44
|
marginInlineEnd: 0,
|
|
44
45
|
height: 20
|
|
46
|
+
},
|
|
47
|
+
[`${componentCls}-tab-badge`]: {
|
|
48
|
+
[`>${antCls}-badge-count`]: {
|
|
49
|
+
color: colorTextSecondary,
|
|
50
|
+
backgroundColor: colorFillQuaternary
|
|
51
|
+
},
|
|
52
|
+
borderRadius: 12
|
|
45
53
|
}
|
|
46
54
|
},
|
|
47
55
|
[`${componentCls}-tab-active`]: {
|
|
56
|
+
/** @deprecated */
|
|
48
57
|
[`${componentCls}-tab-tag`]: {
|
|
49
58
|
color: colorInfo,
|
|
50
59
|
backgroundColor: colorInfoBg
|
|
60
|
+
},
|
|
61
|
+
[`${componentCls}-tab-badge >${antCls}-badge-count`]: {
|
|
62
|
+
color: colorInfo,
|
|
63
|
+
backgroundColor: colorInfoBg
|
|
51
64
|
}
|
|
52
65
|
},
|
|
53
66
|
[`${componentCls}-tab[data-node-key^=divider-]`]: {
|
package/lib/tag/style/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oceanbase/design",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.14",
|
|
4
4
|
"description": "The Design System of OceanBase",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"oceanbase",
|
|
@@ -39,14 +39,14 @@
|
|
|
39
39
|
"build": "father build && cp src/style/reset.css dist/"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@ant-design/cssinjs": "^1.
|
|
42
|
+
"@ant-design/cssinjs": "^1.24.0",
|
|
43
43
|
"@ctrl/tinycolor": "^4.1.0",
|
|
44
44
|
"@inline-svg-unique-id/react": "^1.2.3",
|
|
45
45
|
"@oceanbase/aliyun-theme": "^0.1.6",
|
|
46
46
|
"@oceanbase/icons": "^0.4.7",
|
|
47
47
|
"@oceanbase/util": "^0.4.4",
|
|
48
48
|
"ahooks": "^2.10.14",
|
|
49
|
-
"antd": "^5.26.
|
|
49
|
+
"antd": "^5.26.7",
|
|
50
50
|
"classnames": "^2.5.1",
|
|
51
51
|
"lodash": "^4.17.21",
|
|
52
52
|
"lottie-web": "^5.13.0",
|
|
@@ -66,5 +66,5 @@
|
|
|
66
66
|
"react": ">=16.9.0",
|
|
67
67
|
"react-dom": ">=16.9.0"
|
|
68
68
|
},
|
|
69
|
-
"gitHead": "
|
|
69
|
+
"gitHead": "e5b9f06614070e38c9d6a77244da2320679e3ffa"
|
|
70
70
|
}
|