@oceanbase/design 0.4.16 → 1.0.0-alpha.1

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.
Files changed (46) hide show
  1. package/dist/design.min.js +1 -1
  2. package/es/_util/genStyle.d.ts +0 -2
  3. package/es/_util/genStyle.js +0 -77
  4. package/es/badge/style/index.js +0 -1
  5. package/es/button/style/index.js +1 -30
  6. package/es/card/style/index.js +4 -2
  7. package/es/config-provider/index.js +1 -5
  8. package/es/empty/style/index.js +2 -7
  9. package/es/form/FormItem.d.ts +1 -0
  10. package/es/form/FormItem.js +1 -0
  11. package/es/index.d.ts +0 -1
  12. package/es/index.js +1 -2
  13. package/es/result/style/index.js +2 -5
  14. package/es/table/style/index.js +8 -31
  15. package/es/tabs/index.d.ts +8 -6
  16. package/es/tabs/index.js +10 -7
  17. package/es/tabs/style/index.js +2 -3
  18. package/es/theme/default.js +88 -72
  19. package/es/theme/style/aliyun.less +210 -210
  20. package/es/theme/style/compact.less +231 -231
  21. package/es/theme/style/dark.less +234 -234
  22. package/es/theme/style/default.less +231 -231
  23. package/es/typography/style/index.js +2 -6
  24. package/lib/_util/genStyle.d.ts +0 -2
  25. package/lib/_util/genStyle.js +2 -118
  26. package/lib/badge/style/index.js +0 -1
  27. package/lib/button/style/index.js +1 -37
  28. package/lib/card/style/index.js +9 -1
  29. package/lib/config-provider/index.js +1 -8
  30. package/lib/empty/style/index.js +0 -5
  31. package/lib/form/FormItem.d.ts +1 -0
  32. package/lib/form/FormItem.js +6 -0
  33. package/lib/index.d.ts +0 -1
  34. package/lib/index.js +0 -3
  35. package/lib/result/style/index.js +0 -4
  36. package/lib/table/style/index.js +1 -58
  37. package/lib/tabs/index.d.ts +8 -6
  38. package/lib/tabs/index.js +68 -62
  39. package/lib/tabs/style/index.js +6 -4
  40. package/lib/theme/default.js +86 -71
  41. package/lib/theme/style/aliyun.less +210 -210
  42. package/lib/theme/style/compact.less +231 -231
  43. package/lib/theme/style/dark.less +234 -234
  44. package/lib/theme/style/default.less +231 -231
  45. package/lib/typography/style/index.js +2 -9
  46. package/package.json +6 -6
@@ -19,8 +19,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
19
19
  // src/_util/genStyle.ts
20
20
  var genStyle_exports = {};
21
21
  __export(genStyle_exports, {
22
- genCompactStyle: () => genCompactStyle,
23
- genLargeStyle: () => genLargeStyle
22
+ genCompactStyle: () => genCompactStyle
24
23
  });
25
24
  module.exports = __toCommonJS(genStyle_exports);
26
25
  var genCompactStyle = (componentCls, subComponentCls = "") => {
@@ -38,122 +37,7 @@ var genCompactStyle = (componentCls, subComponentCls = "") => {
38
37
  }
39
38
  };
40
39
  };
41
- var genLargeStyle = (token) => {
42
- const {
43
- antCls,
44
- iconCls,
45
- fontSize,
46
- lineWidth,
47
- borderRadiusLG,
48
- controlHeight,
49
- controlHeightSM,
50
- controlHeightLG
51
- } = token;
52
- const height = controlHeightLG;
53
- const lineHeight = `${controlHeightLG}px`;
54
- return {
55
- // Button
56
- [`${antCls}-btn`]: {
57
- // limit min width for icon button
58
- minWidth: controlHeightLG,
59
- height,
60
- fontSize,
61
- borderRadius: borderRadiusLG,
62
- // Button in Space.Compact
63
- ...genCompactStyle(`${antCls}-btn`)
64
- },
65
- // Radio.Button
66
- [`${antCls}-radio-group`]: {
67
- [`${antCls}-radio-button-wrapper`]: {
68
- height,
69
- lineHeight: `${height - lineWidth * 2}px`,
70
- fontSize,
71
- [`&:first-child`]: {
72
- borderStartStartRadius: borderRadiusLG,
73
- borderEndStartRadius: borderRadiusLG
74
- },
75
- [`&:last-child`]: {
76
- borderStartEndRadius: borderRadiusLG,
77
- borderEndEndRadius: borderRadiusLG
78
- }
79
- }
80
- },
81
- // Select
82
- [`${antCls}-select`]: {
83
- height,
84
- fontSize,
85
- // Select in Space.Compact
86
- ...genCompactStyle(`${antCls}-select`, `${antCls}-select-selector`),
87
- [`${antCls}-select-selector`]: {
88
- borderRadius: borderRadiusLG
89
- },
90
- [`${antCls}-select-selection-item`]: {
91
- fontSize
92
- }
93
- },
94
- [`${antCls}-select-multiple ${antCls}-select-selection-wrap`]: {
95
- // ref: https://github.com/oceanbase/oceanbase-design/pull/881
96
- height: "100%"
97
- },
98
- // Input
99
- [`${antCls}-input-wrapper`]: {
100
- fontSize,
101
- [`${iconCls}`]: {
102
- fontSize
103
- },
104
- [`${antCls}-input-affix-wrapper`]: {
105
- borderStartEndRadius: 0,
106
- borderEndEndRadius: 0
107
- }
108
- },
109
- [`${antCls}-input-affix-wrapper`]: {
110
- height,
111
- borderRadius: borderRadiusLG,
112
- [`&:not(${antCls}-input-affix-wrapper-lg)`]: {
113
- lineHeight: `${controlHeight - lineWidth * 2}px`
114
- },
115
- // avoid to conflict with `${antCls}-input-affix-wrapper` height
116
- [`${antCls}-input`]: {
117
- height: `${controlHeight - lineWidth * 2}px`
118
- },
119
- [`${antCls}-input-lg`]: {
120
- height: controlHeightSM
121
- },
122
- [`${antCls}-input-sm`]: {
123
- height: `${controlHeightLG - lineWidth * 2}px`
124
- }
125
- },
126
- [`${antCls}-input`]: {
127
- height,
128
- fontSize,
129
- borderRadius: borderRadiusLG,
130
- // Input in Space.Compact
131
- ...genCompactStyle(`${antCls}-input`)
132
- },
133
- [`${antCls}-input-search-button`]: {
134
- height,
135
- lineHeight,
136
- borderStartEndRadius: borderRadiusLG,
137
- borderEndEndRadius: borderRadiusLG
138
- },
139
- [`${antCls}-input-group-addon`]: {
140
- fontSize,
141
- borderStartEndRadius: borderRadiusLG,
142
- borderEndEndRadius: borderRadiusLG
143
- },
144
- // set large DatePicker, TimePicker and RangePicker style
145
- [`${antCls}-picker`]: {
146
- height,
147
- borderRadius: borderRadiusLG,
148
- ...genCompactStyle(`${antCls}-picker`),
149
- [`${antCls}-picker-input>input`]: {
150
- fontSize
151
- }
152
- }
153
- };
154
- };
155
40
  // Annotate the CommonJS export names for ESM import in node:
156
41
  0 && (module.exports = {
157
- genCompactStyle,
158
- genLargeStyle
42
+ genCompactStyle
159
43
  });
@@ -43,7 +43,6 @@ var genBadgeStyle = (token) => {
43
43
  },
44
44
  // icon style
45
45
  [`${componentCls}-status-icon`]: {
46
- fontSize: token.fontSizeSM,
47
46
  // remove dot style
48
47
  backgroundColor: "transparent",
49
48
  ["&::after"]: {
@@ -25,43 +25,7 @@ __export(style_exports, {
25
25
  module.exports = __toCommonJS(style_exports);
26
26
  var import_genComponentStyleHook = require("../../_util/genComponentStyleHook");
27
27
  var genButtonStyle = (token) => {
28
- const { componentCls } = token;
29
- const primaryBtnCls = `${componentCls}${componentCls}-primary:not([disabled]):not(${componentCls}-disabled):not(${componentCls}-dangerous):not(${componentCls}-background-ghost)`;
30
- const primaryAndCompactItemBtnCls = `${componentCls}-compact-item${primaryBtnCls}`;
31
- return {
32
- [`${componentCls}`]: {
33
- // remove box-shadow for button
34
- boxShadow: "none !important"
35
- },
36
- // primary button
37
- [`${primaryBtnCls}`]: {
38
- background: "linear-gradient(-59deg, #002BFF 0%, #0080FF 100%)",
39
- border: "none",
40
- ["&:hover"]: {
41
- background: "linear-gradient(120deg, #1AA0FF 0%, #1A53FF 100%)"
42
- },
43
- ["&:active"]: {
44
- background: "linear-gradient(120deg, #0060E6 0%, #0013E6 100%)"
45
- }
46
- },
47
- // primary button in compact item
48
- [`${primaryBtnCls}${componentCls}-compact-last-item`]: {
49
- background: "linear-gradient(-59deg, #002BFF 0%, #002BFF 100%)",
50
- ["&:hover"]: {
51
- background: "linear-gradient(120deg, #1AA0FF 0%, #1A53FF 100%)"
52
- },
53
- ["&:active"]: {
54
- background: "linear-gradient(120deg, #0060E6 0%, #0013E6 100%)"
55
- }
56
- },
57
- [`${primaryAndCompactItemBtnCls}+${primaryAndCompactItemBtnCls}:before`]: {
58
- height: "100%",
59
- top: 0
60
- },
61
- [`${primaryAndCompactItemBtnCls}:hover`]: {
62
- zIndex: 0
63
- }
64
- };
28
+ return {};
65
29
  };
66
30
  var style_default = (prefixCls, isAliyun) => {
67
31
  const useStyle = (0, import_genComponentStyleHook.genComponentStyleHook)("Button", (token) => {
@@ -67,7 +67,15 @@ var genCardStyle = (token) => {
67
67
  [`${componentCls}${componentCls}-no-divider`]: {
68
68
  [`${componentCls}-head`]: {
69
69
  // should not remove border-bottom to avoid tabs inkbar display correctly
70
- borderBottomColor: "transparent"
70
+ borderBottomColor: "transparent",
71
+ // remove divider for top and bottom tabs
72
+ [tabsComponentCls]: {
73
+ [`&${tabsComponentCls}-top, &${tabsComponentCls}-bottom`]: {
74
+ [`${tabsComponentCls}-nav::before`]: {
75
+ border: "none"
76
+ }
77
+ }
78
+ }
71
79
  }
72
80
  },
73
81
  [`${componentCls}${componentCls}-no-divider:not(${componentCls}-contain-tabs)`]: {
@@ -111,14 +111,7 @@ var ConfigProvider = ({
111
111
  ),
112
112
  spin: (0, import_lodash.merge)({}, parentContext.spin, spin),
113
113
  table: (0, import_lodash.merge)({}, parentContext.table, table),
114
- tabs: (0, import_lodash.merge)(
115
- {},
116
- {
117
- indicatorSize: (origin) => origin >= 24 ? origin - 16 : origin
118
- },
119
- parentContext.tabs,
120
- tabs
121
- ),
114
+ tabs: (0, import_lodash.merge)({}, parentContext.tabs, tabs),
122
115
  theme: (0, import_lodash.merge)({}, mergedTheme, {
123
116
  token: (
124
117
  // custom fontFamily
@@ -24,7 +24,6 @@ __export(style_exports, {
24
24
  });
25
25
  module.exports = __toCommonJS(style_exports);
26
26
  var import_genComponentStyleHook = require("../../_util/genComponentStyleHook");
27
- var import_genStyle = require("../../_util/genStyle");
28
27
  var genEmptyStyle = (token) => {
29
28
  const { antCls, componentCls, colorTextTertiary, colorText, colorTextSecondary } = token;
30
29
  return {
@@ -87,10 +86,6 @@ var genEmptyStyle = (token) => {
87
86
  }
88
87
  }
89
88
  }
90
- },
91
- [`${componentCls}-footer`]: {
92
- marginTop: token.marginLG,
93
- ...(0, import_genStyle.genLargeStyle)(token)
94
89
  }
95
90
  },
96
91
  [`${componentCls}-horizontal`]: {
@@ -9,6 +9,7 @@ declare const AntFormItem: (<Values = any>(props: AntFormItemProps<Values>) => R
9
9
  warnings: React.ReactNode[];
10
10
  };
11
11
  };
12
+ export * from 'antd/es/form/FormItem';
12
13
  export type WrapperTooltipProps = Omit<TooltipProps, 'mouseFollow'> & {
13
14
  icon?: React.ReactElement;
14
15
  };
@@ -16,6 +16,7 @@ var __copyProps = (to, from, except, desc) => {
16
16
  }
17
17
  return to;
18
18
  };
19
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
19
20
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
21
  // If the importer is in node compatibility mode or this is not an ESM
21
22
  // file that has been converted to a CommonJS file using a Babel-
@@ -40,6 +41,7 @@ var import_classnames = __toESM(require("classnames"));
40
41
  var import_config_provider = __toESM(require("../config-provider"));
41
42
  var import_useTooltipTypeList = require("../tooltip/hooks/useTooltipTypeList");
42
43
  var import_style = __toESM(require("./style"));
44
+ __reExport(FormItem_exports, require("antd/es/form/FormItem"), module.exports);
43
45
  var AntFormItem = import_antd.Form.Item;
44
46
  var FormItem = ({
45
47
  children,
@@ -95,3 +97,7 @@ var FormItem = ({
95
97
  };
96
98
  FormItem.useStatus = AntFormItem.useStatus;
97
99
  var FormItem_default = FormItem;
100
+ // Annotate the CommonJS export names for ESM import in node:
101
+ 0 && (module.exports = {
102
+ ...require("antd/es/form/FormItem")
103
+ });
package/lib/index.d.ts CHANGED
@@ -74,4 +74,3 @@ declare const useToken: () => {
74
74
  };
75
75
  export { useToken };
76
76
  export type { PresetStatusColorType } from 'antd/es/_util/colors';
77
- export { genLargeStyle } from './_util/genStyle';
package/lib/index.js CHANGED
@@ -63,7 +63,6 @@ __export(src_exports, {
63
63
  Tooltip: () => import_tooltip.default,
64
64
  TreeSelect: () => import_tree_select.default,
65
65
  Typography: () => import_typography.default,
66
- genLargeStyle: () => import_genStyle.genLargeStyle,
67
66
  message: () => import_static_function.message,
68
67
  notification: () => import_static_function.notification,
69
68
  theme: () => import_theme.default,
@@ -110,7 +109,6 @@ var import_badge = __toESM(require("./badge"));
110
109
  var import_lottie = __toESM(require("./lottie"));
111
110
  var import_theme = __toESM(require("./theme"));
112
111
  var import_theme2 = __toESM(require("./theme"));
113
- var import_genStyle = require("./_util/genStyle");
114
112
  var { useToken } = import_theme2.default;
115
113
  // Annotate the CommonJS export names for ESM import in node:
116
114
  0 && (module.exports = {
@@ -147,7 +145,6 @@ var { useToken } = import_theme2.default;
147
145
  Tooltip,
148
146
  TreeSelect,
149
147
  Typography,
150
- genLargeStyle,
151
148
  message,
152
149
  notification,
153
150
  theme,
@@ -24,7 +24,6 @@ __export(style_exports, {
24
24
  });
25
25
  module.exports = __toCommonJS(style_exports);
26
26
  var import_genComponentStyleHook = require("../../_util/genComponentStyleHook");
27
- var import_genStyle = require("../../_util/genStyle");
28
27
  var genResultStyle = (token) => {
29
28
  const { componentCls } = token;
30
29
  return {
@@ -38,9 +37,6 @@ var genResultStyle = (token) => {
38
37
  maxWidth: 600,
39
38
  margin: "0px auto"
40
39
  },
41
- [`${componentCls}-extra`]: {
42
- ...(0, import_genStyle.genLargeStyle)(token)
43
- },
44
40
  [`${componentCls}-content`]: {
45
41
  maxWidth: 1e3,
46
42
  margin: "0px auto",
@@ -72,21 +72,6 @@ var genTableStyle = (token) => {
72
72
  },
73
73
  // body 样式
74
74
  [`${componentCls}-tbody`]: {
75
- // 斑马纹样式
76
- [`tr:nth-child(2n + 1):not(${componentCls}-placeholder):not(${componentCls}-row-selected):not(${antCls}-descriptions-row) > td`]: {
77
- backgroundColor: colorBgBase
78
- },
79
- [`tr:nth-child(2n):not(${componentCls}-placeholder):not(${componentCls}-row-selected):not(${componentCls}-expanded-row):not(${antCls}-descriptions-row) > td`]: {
80
- backgroundColor: colorFillQuaternary
81
- },
82
- // hover 行样式
83
- [`tr:not(${componentCls}-placeholder):not(${componentCls}-expanded-row):not(${antCls}-descriptions-row):hover > td`]: {
84
- backgroundColor: `${colorPrimaryBg} !important`
85
- },
86
- // 选中行样式
87
- [`tr${componentCls}-row-selected > td`]: {
88
- backgroundColor: `${colorPrimaryBg} !important`
89
- },
90
75
  [`${componentCls}-tbody-virtual-scrollbar ${componentCls}-tbody-virtual-scrollbar-thumb`]: {
91
76
  background: `${token.colorFillSecondary} !important`
92
77
  },
@@ -152,28 +137,8 @@ var genTableStyle = (token) => {
152
137
  }
153
138
  }
154
139
  },
155
- // 滚动表格样式
156
- // 由于滚动表格会在 tbody 下最前面多一个 tr 元素,因此需要设置相反的斑马条样式
157
- // .ant-table-scroll-horizontal: 水平滚动
158
- // .ant-table-fixed-header: 垂直滚动
159
- [`${componentCls}-wrapper ${componentCls}${componentCls}-scroll-horizontal, ${componentCls}-wrapper ${componentCls}${componentCls}-fixed-header`]: {
160
- [`${componentCls}-tbody`]: {
161
- // 斑马纹样式
162
- [`tr:nth-child(2n + 1):not(${componentCls}-placeholder):not(${componentCls}-row-selected):not(${antCls}-descriptions-row) > td`]: {
163
- backgroundColor: colorFillQuaternary
164
- },
165
- [`tr:nth-child(2n):not(${componentCls}-placeholder):not(${componentCls}-row-selected):not(${componentCls}-expanded-row):not(${antCls}-descriptions-row) > td`]: {
166
- backgroundColor: colorBgBase
167
- }
168
- }
169
- },
170
140
  // 带边框的表格样式
171
141
  [`${componentCls}-wrapper ${componentCls}${componentCls}-bordered`]: {
172
- [`${componentCls}-thead > tr`]: {
173
- ["th"]: {
174
- backgroundColor: colorFillQuaternary
175
- }
176
- },
177
142
  [`${componentCls}-footer`]: {
178
143
  borderRadius: `0px 0px ${token.borderRadiusLG}px ${token.borderRadiusLG}px`
179
144
  }
@@ -227,37 +192,15 @@ var genTableStyle = (token) => {
227
192
  // },
228
193
  // },
229
194
  // },
230
- // 非可展开表格、不带 footer 表格、非空表格、不带边框表格: 底部添加分隔线,并去掉底部圆角
195
+ // 非可展开表格、不带 footer 表格、非空表格、不带边框表格: 去掉底部圆角
231
196
  [`${componentCls}-wrapper:not(${componentCls}-expandable):not(${componentCls}-has-footer) ${componentCls}:not(${componentCls}-bordered):not(${componentCls}-empty)`]: {
232
- borderBottom: `1px solid ${colorBorderSecondary}`,
233
197
  borderBottomLeftRadius: 0,
234
198
  borderBottomRightRadius: 0
235
199
  },
236
- // 去掉非展开表格的边框
237
- [`${componentCls}-wrapper:not(${componentCls}-expandable)`]: {
238
- [`${componentCls}:not(${componentCls}-bordered)`]: {
239
- [`${componentCls}-tbody`]: {
240
- [`tr:not(${componentCls}-measure-row) > td`]: {
241
- border: "none"
242
- }
243
- }
244
- }
245
- },
246
200
  // 可展开表格样式
247
201
  [`${componentCls}-wrapper${componentCls}-expandable`]: {
248
202
  [`${componentCls}`]: {
249
203
  [`${componentCls}-tbody`]: {
250
- // 去掉斑马纹
251
- [`tr:nth-child(n):not(${componentCls}-placeholder):not(${componentCls}-row-selected):not(${componentCls}-expanded-row)`]: {
252
- ["& > td"]: {
253
- backgroundColor: colorBgBase
254
- },
255
- ["&:hover"]: {
256
- td: {
257
- backgroundColor: colorPrimaryBg
258
- }
259
- }
260
- },
261
204
  [`${componentCls}-expanded-row > td`]: {
262
205
  // 除内嵌子表格外,设置其他内嵌元素样式
263
206
  [`& > *:not(${componentCls}-wrapper):not(${componentCls}-expanded-row-fixed)`]: {
@@ -1,6 +1,8 @@
1
1
  import React from 'react';
2
- import type { TabsProps as AntTabsProps, TabsPosition as AntTabsPosition } from 'antd/es/tabs';
2
+ import type { TabsProps as AntTabsProps, TabsPosition as AntTabsPosition, TabsRef } from 'antd/es/tabs';
3
3
  import type { Tab as AntTab } from 'rc-tabs/es/interface';
4
+ import { genTabsStyle } from './style';
5
+ import TabPane from './TabPane';
4
6
  import type { TabPaneProps } from './TabPane';
5
7
  import type { BadgeProps } from '../badge';
6
8
  export * from 'antd/es/tabs';
@@ -17,13 +19,13 @@ export type Tab = {
17
19
  badge?: BadgeType;
18
20
  } & (AntTab | AntTabOptional);
19
21
  export interface TabsProps extends Omit<AntTabsProps, 'items'> {
22
+ divider?: boolean;
20
23
  items?: Tab[];
21
24
  }
22
25
  export type TabsPosition = AntTabsPosition;
23
- declare const Tabs: {
24
- ({ children, items, type, tabPosition, prefixCls: customizePrefixCls, className, ...restProps }: TabsProps): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
25
- TabPane: React.FC<TabPaneProps>;
26
- genTabsStyle: (token: Partial<import("./style").TabsToken>) => import("@ant-design/cssinjs").CSSObject;
27
- displayName: string;
26
+ type CompoundedComponent = React.ForwardRefExoticComponent<TabsProps & React.RefAttributes<TabsRef>> & {
27
+ TabPane: typeof TabPane;
28
+ genTabsStyle: typeof genTabsStyle;
28
29
  };
30
+ declare const Tabs: CompoundedComponent;
29
31
  export default Tabs;
package/lib/tabs/index.js CHANGED
@@ -33,9 +33,9 @@ __export(tabs_exports, {
33
33
  default: () => tabs_default
34
34
  });
35
35
  module.exports = __toCommonJS(tabs_exports);
36
- var import_util = require("@oceanbase/util");
37
- var import_antd = require("antd");
38
36
  var import_react = __toESM(require("react"));
37
+ var import_antd = require("antd");
38
+ var import_util = require("@oceanbase/util");
39
39
  var import_classnames = __toESM(require("classnames"));
40
40
  var import_badge = __toESM(require("../badge"));
41
41
  var import_config_provider = __toESM(require("../config-provider"));
@@ -46,67 +46,73 @@ __reExport(tabs_exports, require("antd/es/tabs"), module.exports);
46
46
  var isReactNode = (item) => {
47
47
  return import_react.default.isValidElement(item);
48
48
  };
49
- var Tabs = ({
50
- children,
51
- items,
52
- type,
53
- tabPosition,
54
- prefixCls: customizePrefixCls,
55
- className,
56
- ...restProps
57
- }) => {
58
- const { getPrefixCls } = (0, import_react.useContext)(import_config_provider.default.ConfigContext);
59
- const prefixCls = getPrefixCls("tabs", customizePrefixCls);
60
- const { wrapSSR } = (0, import_style.default)(prefixCls);
61
- const tabsCls = (0, import_classnames.default)(className);
62
- const isHorizontal = !tabPosition || tabPosition === "top" || tabPosition === "bottom";
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) });
49
+ var Tabs = import_react.default.forwardRef(
50
+ ({
51
+ children,
52
+ divider = false,
53
+ items,
54
+ type,
55
+ tabPosition,
56
+ prefixCls: customizePrefixCls,
57
+ className,
58
+ ...restProps
59
+ }, ref) => {
60
+ const { getPrefixCls } = (0, import_react.useContext)(import_config_provider.default.ConfigContext);
61
+ const prefixCls = getPrefixCls("tabs", customizePrefixCls);
62
+ const { wrapSSR } = (0, import_style.default)(prefixCls);
63
+ const tabsCls = (0, import_classnames.default)(className, {
64
+ [`${prefixCls}-no-divider`]: !divider
65
+ });
66
+ const isHorizontal = !tabPosition || tabPosition === "top" || tabPosition === "bottom";
67
+ const dividerList = (items == null ? void 0 : items.filter((item) => item.divider)) || [];
68
+ const renderBadge = (0, import_react.useCallback)(
69
+ (badge) => {
70
+ if (typeof badge === "object" && !isReactNode(badge)) {
71
+ return /* @__PURE__ */ import_react.default.createElement(import_badge.default, { ...badge, className: (0, import_classnames.default)(`${prefixCls}-tab-badge`, badge.className) });
72
+ }
73
+ return /* @__PURE__ */ import_react.default.createElement(import_badge.default, { className: `${prefixCls}-tab-badge`, count: badge });
74
+ },
75
+ [prefixCls]
76
+ );
77
+ let newItems = (0, import_useLegacyItems.default)(items, children);
78
+ newItems = newItems == null ? void 0 : newItems.map((item) => {
79
+ if (!(0, import_util.isNullValue)(item.divider)) {
80
+ return {
81
+ ...item,
82
+ key: `divider-${dividerList == null ? void 0 : dividerList.indexOf(item)}`,
83
+ label: /* @__PURE__ */ import_react.default.createElement(
84
+ import_antd.Divider,
85
+ {
86
+ type: isHorizontal ? "vertical" : "horizontal",
87
+ className: `${prefixCls}-divider`
88
+ }
89
+ ),
90
+ disabled: true
91
+ };
92
+ } else if (!(0, import_util.isNullValue)(item.tag) || !(0, import_util.isNullValue)(item.badge)) {
93
+ return {
94
+ ...item,
95
+ 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))
96
+ };
68
97
  }
69
- return /* @__PURE__ */ import_react.default.createElement(import_badge.default, { className: `${prefixCls}-tab-badge`, count: badge });
70
- },
71
- [prefixCls]
72
- );
73
- let newItems = (0, import_useLegacyItems.default)(items, children);
74
- newItems = newItems == null ? void 0 : newItems.map((item) => {
75
- if (!(0, import_util.isNullValue)(item.divider)) {
76
- return {
77
- ...item,
78
- key: `divider-${dividerList == null ? void 0 : dividerList.indexOf(item)}`,
79
- label: /* @__PURE__ */ import_react.default.createElement(
80
- import_antd.Divider,
81
- {
82
- type: isHorizontal ? "vertical" : "horizontal",
83
- className: `${prefixCls}-divider`
84
- }
85
- ),
86
- disabled: true
87
- };
88
- } else if (!(0, import_util.isNullValue)(item.tag) || !(0, import_util.isNullValue)(item.badge)) {
89
- return {
90
- ...item,
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))
92
- };
93
- }
94
- return item;
95
- });
96
- return wrapSSR(
97
- /* @__PURE__ */ import_react.default.createElement(
98
- import_antd.Tabs,
99
- {
100
- items: newItems,
101
- type,
102
- tabPosition,
103
- prefixCls: customizePrefixCls,
104
- className: tabsCls,
105
- ...restProps
106
- }
107
- )
108
- );
109
- };
98
+ return item;
99
+ });
100
+ return wrapSSR(
101
+ /* @__PURE__ */ import_react.default.createElement(
102
+ import_antd.Tabs,
103
+ {
104
+ ref,
105
+ items: newItems,
106
+ type,
107
+ tabPosition,
108
+ prefixCls: customizePrefixCls,
109
+ className: tabsCls,
110
+ ...restProps
111
+ }
112
+ )
113
+ );
114
+ }
115
+ );
110
116
  Tabs.TabPane = import_TabPane.default;
111
117
  Tabs.genTabsStyle = import_style.genTabsStyle;
112
118
  if (process.env.NODE_ENV !== "production") {
@@ -28,10 +28,12 @@ var genTabsStyle = (token) => {
28
28
  const { antCls, componentCls, colorInfo, colorInfoBg, colorTextSecondary, colorFillQuaternary } = token;
29
29
  return {
30
30
  [componentCls]: {
31
- [`&${componentCls}-top, &${componentCls}-bottom`]: {
32
- [`${componentCls}-nav::before`]: {
33
- // 页签位置为 top bottom 时,去掉分割线
34
- border: "none"
31
+ [`&${componentCls}-no-divider`]: {
32
+ // divider prop work for top and bottom tabs
33
+ [`&${componentCls}-top, &${componentCls}-bottom`]: {
34
+ [`${componentCls}-nav::before`]: {
35
+ border: "none"
36
+ }
35
37
  }
36
38
  },
37
39
  [`${componentCls}-tab`]: {