@oceanbase/design 1.0.0-alpha.3 → 1.0.0-alpha.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.
Files changed (60) hide show
  1. package/dist/design.min.js +1 -1
  2. package/es/alert/index.d.ts +2 -2
  3. package/es/alert/index.js +13 -4
  4. package/es/alert/style/index.js +152 -58
  5. package/es/badge/index.js +2 -3
  6. package/es/badge/style/index.js +1 -3
  7. package/es/card/index.d.ts +4 -0
  8. package/es/card/index.js +64 -7
  9. package/es/card/style/index.js +29 -5
  10. package/es/config-provider/index.d.ts +2 -2
  11. package/es/config-provider/index.js +26 -2
  12. package/es/descriptions/hooks/useItems.d.ts +6 -6
  13. package/es/drawer/style/index.js +24 -6
  14. package/es/form/FormItem.d.ts +1 -0
  15. package/es/form/FormItem.js +14 -4
  16. package/es/form/style/index.js +13 -2
  17. package/es/input-number/index.d.ts +2 -1
  18. package/es/locale/ja-JP.d.ts +3 -0
  19. package/es/locale/ja-JP.js +28 -0
  20. package/es/modal/Modal.js +20 -6
  21. package/es/modal/style/index.js +62 -19
  22. package/es/static-function/index.js +13 -4
  23. package/es/table/style/index.js +3 -4
  24. package/es/tabs/style/index.js +4 -2
  25. package/es/tag/index.d.ts +1 -0
  26. package/es/tag/index.js +3 -2
  27. package/es/tag/style/index.js +8 -2
  28. package/es/theme/default.js +9 -3
  29. package/es/theme/style/compact.less +7 -7
  30. package/es/theme/style/default.less +7 -7
  31. package/lib/alert/index.d.ts +2 -2
  32. package/lib/alert/index.js +11 -3
  33. package/lib/alert/style/index.js +170 -71
  34. package/lib/badge/index.js +2 -2
  35. package/lib/badge/style/index.js +1 -3
  36. package/lib/card/index.d.ts +4 -0
  37. package/lib/card/index.js +61 -4
  38. package/lib/card/style/index.js +52 -6
  39. package/lib/config-provider/index.d.ts +2 -2
  40. package/lib/config-provider/index.js +35 -2
  41. package/lib/descriptions/hooks/useItems.d.ts +6 -6
  42. package/lib/drawer/style/index.js +25 -4
  43. package/lib/form/FormItem.d.ts +1 -0
  44. package/lib/form/FormItem.js +10 -2
  45. package/lib/form/style/index.js +19 -0
  46. package/lib/input-number/index.d.ts +2 -1
  47. package/lib/locale/ja-JP.d.ts +3 -0
  48. package/lib/locale/ja-JP.js +60 -0
  49. package/lib/modal/Modal.js +26 -6
  50. package/lib/modal/style/index.js +76 -17
  51. package/lib/static-function/index.js +7 -1
  52. package/lib/table/style/index.js +3 -4
  53. package/lib/tabs/style/index.js +5 -0
  54. package/lib/tag/index.d.ts +1 -0
  55. package/lib/tag/index.js +3 -1
  56. package/lib/tag/style/index.js +8 -0
  57. package/lib/theme/default.js +9 -3
  58. package/lib/theme/style/compact.less +7 -7
  59. package/lib/theme/style/default.less +7 -7
  60. package/package.json +5 -5
@@ -310,12 +310,12 @@
310
310
  @colorTextQuaternary: #b6c0d4;
311
311
  @colorFill: #cdd5e4;
312
312
  @colorFillSecondary: #e2e8f3;
313
- @colorFillTertiary: #eff3fa;
314
- @colorFillQuaternary: #f7f9fc;
313
+ @colorFillTertiary: #ebeff7;
314
+ @colorFillQuaternary: #f5f7fc;
315
315
  @colorBgSolid: rgb(0,0,0);
316
316
  @colorBgSolidHover: rgba(0,0,0,0.75);
317
317
  @colorBgSolidActive: rgba(0,0,0,0.95);
318
- @colorBgLayout: #f7f9fc;
318
+ @colorBgLayout: #fbfcfe;
319
319
  @colorBgContainer: #ffffff;
320
320
  @colorBgElevated: #ffffff;
321
321
  @colorBgSpotlight: #ffffff;
@@ -421,14 +421,14 @@
421
421
  @colorFuchsiaBg: #faf0fc;
422
422
  @colorFuchsiaText: #580e67;
423
423
  @colorIcon: #8592ad;
424
- @colorBgContainerDisabled: #eff3fa;
424
+ @colorBgContainerDisabled: #ebeff7;
425
425
  @boxShadow: 0 6px 16px 0 rgba(54, 69, 99, 0.08), 0 3px 6px -4px rgba(54, 69, 99, 0.12), 0 9px 28px 8px rgba(54, 69, 99, 0.05);
426
426
  @boxShadowSecondary: 0 6px 16px 0 rgba(54, 69, 99, 0.08), 0 3px 6px -4px rgba(54, 69, 99, 0.12), 0 9px 28px 8px rgba(54, 69, 99, 0.05);
427
427
  @boxShadowTertiary: 0 1px 2px 0 rgba(54, 69, 99, 0.03), 0 1px 6px -1px rgba(54, 69, 99, 0.02), 0 2px 4px 0 rgba(54, 69, 99, 0.02);
428
428
  @lineWidthFocus: 3px;
429
429
  @colorFillContent: #e2e8f3;
430
430
  @colorFillContentHover: #cdd5e4;
431
- @colorFillAlter: #f7f9fc;
431
+ @colorFillAlter: #f5f7fc;
432
432
  @colorBorderBg: #ffffff;
433
433
  @colorSplit: rgba(13,63,155,0.12);
434
434
  @colorTextPlaceholder: #b6c0d4;
@@ -446,11 +446,11 @@
446
446
  @fontSizeIcon: 12px;
447
447
  @controlOutlineWidth: 2px;
448
448
  @controlInteractiveSize: 14px;
449
- @controlItemBgHover: #eff3fa;
449
+ @controlItemBgHover: #ebeff7;
450
450
  @controlItemBgActive: #e6f4ff;
451
451
  @controlItemBgActiveHover: #b0dbff;
452
452
  @controlItemBgActiveDisabled: #cdd5e4;
453
- @controlTmpOutline: #f7f9fc;
453
+ @controlTmpOutline: #f5f7fc;
454
454
  @controlOutline: rgba(5,145,255,0.1);
455
455
  @opacityLoading: 0.65;
456
456
  @linkDecoration: none;
@@ -3,10 +3,10 @@ import type { AlertProps as AntAlertProps } from 'antd/es/alert';
3
3
  export * from 'antd/es/alert';
4
4
  export interface AlertProps extends AntAlertProps {
5
5
  ghost?: boolean;
6
- colored?: boolean;
6
+ mini?: boolean;
7
7
  }
8
8
  declare const Alert: {
9
- ({ type, ghost, colored, prefixCls: customizePrefixCls, className, ...restProps }: AlertProps): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
9
+ ({ type: typeProp, showIcon, closable, ghost, mini, banner, prefixCls: customizePrefixCls, className, ...restProps }: AlertProps): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
10
10
  ErrorBoundary: typeof import("antd/es/alert/ErrorBoundary").default;
11
11
  displayName: string;
12
12
  };
@@ -48,20 +48,25 @@ var iconMapOutlined = {
48
48
  warning: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons.ExclamationCircleOutlined, {})
49
49
  };
50
50
  var Alert = ({
51
- type,
51
+ type: typeProp,
52
+ showIcon = true,
53
+ closable,
52
54
  ghost,
53
- colored,
55
+ mini,
56
+ banner,
54
57
  prefixCls: customizePrefixCls,
55
58
  className,
56
59
  ...restProps
57
60
  }) => {
61
+ const type = banner && !typeProp ? "warning" : typeProp;
58
62
  const { getPrefixCls } = (0, import_react.useContext)(import_config_provider.default.ConfigContext);
59
63
  const prefixCls = getPrefixCls("alert", customizePrefixCls);
60
64
  const { wrapSSR } = (0, import_style.default)(prefixCls);
61
65
  const alertCls = (0, import_classnames.default)(
62
66
  {
67
+ [`${prefixCls}-closable`]: closable,
63
68
  [`${prefixCls}-ghost`]: ghost,
64
- [`${prefixCls}-colored`]: colored
69
+ [`${prefixCls}-mini`]: mini
65
70
  },
66
71
  className
67
72
  );
@@ -70,6 +75,9 @@ var Alert = ({
70
75
  import_antd.Alert,
71
76
  {
72
77
  type,
78
+ showIcon,
79
+ closable,
80
+ banner,
73
81
  icon: iconMapOutlined[type],
74
82
  prefixCls: customizePrefixCls,
75
83
  className: alertCls,
@@ -24,118 +24,217 @@ __export(style_exports, {
24
24
  });
25
25
  module.exports = __toCommonJS(style_exports);
26
26
  var import_genComponentStyleHook = require("../../_util/genComponentStyleHook");
27
- var genTypeStyle = (color, token) => {
28
- const borderWidth = 8;
29
- return {
30
- content: '""',
31
- width: borderWidth,
32
- // Y 轴旋转 60deg 是为了让圆角有一定的视觉拉伸,以与原先的边框贴合更加紧密
33
- transform: "rotateY(60deg)",
34
- backgroundColor: color,
35
- position: "absolute",
36
- height: `calc(100% - ${token.lineWidth}px)`,
37
- left: -token.lineWidth - borderWidth / 2 / 2,
38
- top: token.lineWidth / 2,
39
- borderTopLeftRadius: token.borderRadiusLG,
40
- borderBottomLeftRadius: token.borderRadiusLG
27
+ var import_lodash = require("lodash");
28
+ var genAlertTypeStyle = (type, token) => {
29
+ const { componentCls } = token;
30
+ const textColor = token[`color${(0, import_lodash.upperFirst)(type)}Text`];
31
+ const hoverColor = token[`color${(0, import_lodash.upperFirst)(type)}TextHover`];
32
+ const activeColor = token[`color${(0, import_lodash.upperFirst)(type)}TextActive`];
33
+ const linkStyle = {
34
+ color: textColor,
35
+ textDecoration: "underline",
36
+ "&:hover": {
37
+ color: hoverColor
38
+ },
39
+ "&:active": {
40
+ color: activeColor
41
+ }
41
42
  };
42
- };
43
- var genColoredStyle = (color, colorHover, token) => {
44
- const { componentCls, iconCls } = token;
45
43
  return {
46
44
  [`${componentCls}-message`]: {
47
- color
45
+ color: textColor,
46
+ a: linkStyle
48
47
  },
49
48
  [`${componentCls}-description`]: {
50
- color
49
+ a: linkStyle
51
50
  },
52
- [`${componentCls}-close-icon`]: {
53
- [`${iconCls}`]: {
54
- color,
55
- "&:hover": {
56
- color: colorHover
57
- }
58
- },
59
- [`${componentCls}-close-text`]: {
60
- color,
61
- "&:hover": {
62
- color: colorHover
63
- }
64
- }
51
+ [`${componentCls}-icon`]: {
52
+ color: textColor
65
53
  }
66
54
  };
67
55
  };
68
56
  var genAlertStyle = (token) => {
69
- const {
70
- componentCls,
71
- colorSuccess,
72
- colorSuccessHover,
73
- colorInfo,
74
- colorInfoHover,
75
- colorWarning,
76
- colorWarningHover,
77
- colorError,
78
- colorErrorHover,
79
- colorIcon,
80
- colorIconHover,
81
- motionDurationMid
82
- } = token;
57
+ const { componentCls, colorIcon, colorIconHover, motionDurationMid } = token;
83
58
  const height = token.fontSize * token.lineHeight;
59
+ const iconWidth = token.fontSizeLG;
60
+ const contentStartOffset = iconWidth + token.marginXS;
61
+ const closeIconWidth = height;
84
62
  return {
85
63
  [`${componentCls}`]: {
86
64
  // vertical align to flex-start
87
65
  alignItems: "flex-start !important",
88
- paddingRight: token.padding,
66
+ paddingInline: token.padding,
67
+ position: "relative",
89
68
  [`${componentCls}-icon`]: {
90
- height
69
+ height,
70
+ fontSize: token.fontSizeLG,
71
+ marginInlineEnd: token.marginXS,
72
+ flexShrink: 0
91
73
  },
92
74
  [`${componentCls}-close-icon`]: {
75
+ position: "absolute",
76
+ top: token.paddingXS,
77
+ insetInlineEnd: token.padding,
93
78
  height,
94
79
  color: colorIcon,
95
80
  transition: `color ${motionDurationMid}`,
81
+ flexShrink: 0,
82
+ display: "flex",
83
+ alignItems: "center",
96
84
  "&:hover": {
97
85
  color: colorIconHover
98
86
  }
99
- }
87
+ },
88
+ // Default link styles (will be overridden by type-specific styles)
89
+ [`${componentCls}-message`]: {
90
+ a: {
91
+ textDecoration: "underline"
92
+ }
93
+ },
94
+ [`${componentCls}-description`]: {
95
+ a: {
96
+ textDecoration: "underline"
97
+ }
98
+ },
99
+ [`&${componentCls}-success`]: genAlertTypeStyle("success", token),
100
+ [`&${componentCls}-info`]: genAlertTypeStyle("info", token),
101
+ [`&${componentCls}-warning`]: genAlertTypeStyle("warning", token),
102
+ [`&${componentCls}-error`]: genAlertTypeStyle("error", token)
100
103
  },
101
104
  [`${componentCls}:not(${componentCls}-with-description)`]: {
102
- paddingLeft: token.padding
105
+ flexWrap: "wrap",
106
+ [`${componentCls}-content`]: {
107
+ flex: `1 1 calc(100% - ${contentStartOffset + closeIconWidth + token.padding}px)`,
108
+ minWidth: 0,
109
+ maxWidth: `calc(100% - ${contentStartOffset + closeIconWidth + token.padding}px)`,
110
+ wordBreak: "break-word"
111
+ },
112
+ [`${componentCls}-action`]: {
113
+ width: `calc(100% - ${contentStartOffset + token.padding}px)`,
114
+ marginInlineStart: contentStartOffset,
115
+ marginTop: token.marginXS
116
+ }
103
117
  },
104
118
  [`${componentCls}${componentCls}-with-description`]: {
105
- paddingBlock: token.padding,
119
+ paddingBlock: token.paddingSM,
120
+ flexWrap: "wrap",
106
121
  [`${componentCls}-message`]: {
107
- fontWeight: 500,
108
- marginBottom: token.marginXXS
122
+ fontSize: token.fontSize,
123
+ fontWeight: token.fontWeightStrong,
124
+ marginBottom: token.marginXXS,
125
+ wordBreak: "break-word"
109
126
  },
110
127
  [`${componentCls}-description`]: {
111
- color: token.colorTextSecondary
128
+ wordBreak: "break-word"
112
129
  },
113
- [`${componentCls}-icon`]: {
114
- fontSize: token.fontSizeHeading4,
115
- height: token.fontSizeHeading3,
116
- marginInlineEnd: token.margin
130
+ [`${componentCls}-content`]: {
131
+ flex: `1 1 calc(100% - ${contentStartOffset + closeIconWidth + token.padding}px)`,
132
+ minWidth: 0,
133
+ maxWidth: `calc(100% - ${contentStartOffset + closeIconWidth + token.padding}px)`,
134
+ wordBreak: "break-word"
117
135
  },
118
136
  [`${componentCls}-action`]: {
119
- marginInlineStart: token.marginXS
137
+ width: `calc(100% - ${contentStartOffset + token.padding}px)`,
138
+ marginInlineStart: contentStartOffset,
139
+ marginTop: token.marginSM
140
+ },
141
+ [`${componentCls}-close-icon`]: {
142
+ top: token.paddingSM
120
143
  }
121
144
  },
122
- [`${componentCls}:not(${componentCls}-banner):not(${componentCls}-ghost)`]: {
123
- [`&${componentCls}-success::before`]: genTypeStyle(colorSuccess, token),
124
- [`&${componentCls}-info::before`]: genTypeStyle(colorInfo, token),
125
- [`&${componentCls}-warning::before`]: genTypeStyle(colorWarning, token),
126
- [`&${componentCls}-error::before`]: genTypeStyle(colorError, token)
127
- },
128
145
  [`${componentCls}${componentCls}-ghost`]: {
129
146
  backgroundColor: "transparent",
130
147
  border: "none",
131
- padding: 0,
148
+ padding: "0px !important",
132
149
  borderRadius: 0
133
150
  },
134
- [`${componentCls}-colored`]: {
135
- [`&${componentCls}-success`]: genColoredStyle(colorSuccess, colorSuccessHover, token),
136
- [`&${componentCls}-info`]: genColoredStyle(colorInfo, colorInfoHover, token),
137
- [`&${componentCls}-warning`]: genColoredStyle(colorWarning, colorWarningHover, token),
138
- [`&${componentCls}-error`]: genColoredStyle(colorError, colorErrorHover, token)
151
+ [`${componentCls}${componentCls}-mini`]: {
152
+ paddingBlock: token.paddingXXS,
153
+ paddingInline: token.paddingXS,
154
+ border: "none",
155
+ width: "fit-content",
156
+ display: "inline-flex",
157
+ alignItems: "center",
158
+ flexWrap: "nowrap",
159
+ [`${componentCls}-icon`]: {
160
+ marginInlineEnd: token.paddingXS,
161
+ flexShrink: 0,
162
+ display: "flex",
163
+ alignItems: "center",
164
+ justifyContent: "center",
165
+ lineHeight: 1
166
+ },
167
+ [`${componentCls}-message`]: {
168
+ whiteSpace: "nowrap",
169
+ wordBreak: "normal",
170
+ overflow: "visible",
171
+ lineHeight: token.lineHeight,
172
+ display: "flex",
173
+ alignItems: "center"
174
+ },
175
+ [`${componentCls}-content`]: {
176
+ display: "flex",
177
+ alignItems: "center",
178
+ flex: "0 1 auto",
179
+ whiteSpace: "nowrap",
180
+ minWidth: 0,
181
+ lineHeight: token.lineHeight
182
+ },
183
+ [`${componentCls}-close-icon`]: {
184
+ position: "relative",
185
+ top: token.paddingXXS,
186
+ insetInlineEnd: "auto",
187
+ height: "auto",
188
+ flexShrink: 0,
189
+ marginInlineStart: 0
190
+ },
191
+ [`&${componentCls}-closable`]: {
192
+ [`${componentCls}-content`]: {
193
+ paddingInlineEnd: token.paddingXS
194
+ }
195
+ },
196
+ [`&:not(${componentCls}-with-description)`]: {
197
+ flexWrap: "nowrap",
198
+ [`${componentCls}-content`]: {
199
+ flex: "0 1 auto",
200
+ minWidth: 0,
201
+ maxWidth: "none",
202
+ wordBreak: "normal"
203
+ }
204
+ },
205
+ [`&${componentCls}-with-description`]: {
206
+ paddingBlock: token.paddingXXS,
207
+ flexDirection: "row",
208
+ alignItems: "flex-start",
209
+ position: "relative",
210
+ flexWrap: "nowrap",
211
+ [`${componentCls}-icon`]: {
212
+ alignSelf: "flex-start",
213
+ marginTop: 0
214
+ },
215
+ [`${componentCls}-content`]: {
216
+ flexDirection: "column",
217
+ alignItems: "flex-start",
218
+ flex: "0 1 auto",
219
+ minWidth: 0,
220
+ maxWidth: "none",
221
+ wordBreak: "normal"
222
+ },
223
+ [`${componentCls}-message`]: {
224
+ marginBottom: token.marginXXS,
225
+ whiteSpace: "nowrap",
226
+ wordBreak: "normal"
227
+ },
228
+ [`${componentCls}-description`]: {
229
+ whiteSpace: "nowrap",
230
+ wordBreak: "normal"
231
+ },
232
+ [`${componentCls}-close-icon`]: {
233
+ position: "absolute",
234
+ top: token.paddingXXS,
235
+ insetInlineEnd: token.paddingXS
236
+ }
237
+ }
139
238
  }
140
239
  };
141
240
  };
@@ -43,7 +43,7 @@ __reExport(badge_exports, require("antd/es/badge"), module.exports);
43
43
  var import_jsx_runtime = require("react/jsx-runtime");
44
44
  var Badge = import_react.default.forwardRef(
45
45
  ({ prefixCls: customizePrefixCls, className, status, text, icon, ...restProps }, ref) => {
46
- const { getPrefixCls, iconPrefixCls } = (0, import_react.useContext)(import_config_provider.default.ConfigContext);
46
+ const { getPrefixCls } = (0, import_react.useContext)(import_config_provider.default.ConfigContext);
47
47
  const prefixCls = getPrefixCls("badge", customizePrefixCls);
48
48
  const { wrapSSR, hashId } = (0, import_style.default)(prefixCls);
49
49
  const iconMap = {
@@ -54,7 +54,7 @@ var Badge = import_react.default.forwardRef(
54
54
  style: {
55
55
  display: "inline-block"
56
56
  },
57
- className: `${iconPrefixCls}-spin`
57
+ spin: true
58
58
  }
59
59
  ),
60
60
  success: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons.CheckCircleFilled, {}),
@@ -35,9 +35,7 @@ var genBadgeStyle = (token) => {
35
35
  [`${componentCls}${componentCls}-status`]: {
36
36
  // dot style
37
37
  [`${componentCls}-status-dot`]: {
38
- [`&${componentCls}-status-default`]: {
39
- backgroundColor: token.colorFill
40
- }
38
+ [`&${componentCls}-status-default`]: {}
41
39
  },
42
40
  // icon style
43
41
  [`${componentCls}-status-icon`]: {
@@ -8,6 +8,10 @@ export interface CardTabListType extends AntCardTabListType {
8
8
  export interface CardProps extends AntCardProps {
9
9
  divided?: boolean;
10
10
  tabList?: CardTabListType[];
11
+ collapsible?: boolean;
12
+ defaultCollapsed?: boolean;
13
+ collapsed?: boolean;
14
+ onCollapse?: (collapsed: boolean) => void;
11
15
  }
12
16
  declare const _default: React.ForwardRefExoticComponent<CardProps & React.RefAttributes<HTMLDivElement>> & {
13
17
  Grid: React.FC<import("antd/es/card").CardGridProps>;
package/lib/card/index.js CHANGED
@@ -37,8 +37,10 @@ var import_util = require("@oceanbase/util");
37
37
  var import_antd = require("antd");
38
38
  var import_classnames = __toESM(require("classnames"));
39
39
  var import_react = __toESM(require("react"));
40
+ var import_icons = require("@oceanbase/icons");
40
41
  var import_config_provider = __toESM(require("../config-provider"));
41
42
  var import_util2 = require("../_util");
43
+ var import_theme = __toESM(require("../theme"));
42
44
  var import_style = __toESM(require("./style"));
43
45
  __reExport(card_exports, require("antd/es/card/Card"), module.exports);
44
46
  __reExport(card_exports, require("antd/es/card"), module.exports);
@@ -55,20 +57,72 @@ var Card = import_react.default.forwardRef(
55
57
  bodyStyle,
56
58
  styles,
57
59
  className,
60
+ collapsible,
61
+ defaultCollapsed,
62
+ collapsed: outerCollapsed,
63
+ onCollapse,
64
+ extra,
58
65
  ...restProps
59
66
  }, ref) => {
60
67
  var _a;
61
- const { getPrefixCls, card: contextCard } = (0, import_react.useContext)(import_config_provider.default.ConfigContext);
68
+ const {
69
+ getPrefixCls,
70
+ card: contextCard,
71
+ iconPrefixCls
72
+ } = (0, import_react.useContext)(import_config_provider.default.ConfigContext);
73
+ const { token } = import_theme.default.useToken();
62
74
  const divided = outerDivided ?? (contextCard == null ? void 0 : contextCard.divided) ?? true;
63
75
  const prefixCls = getPrefixCls("card", customizePrefixCls);
64
76
  const tabsPrefixCls = getPrefixCls("tabs", customizePrefixCls);
65
77
  const { wrapSSR } = (0, import_style.default)(prefixCls, tabsPrefixCls);
78
+ const [internalCollapsed, setInternalCollapsed] = (0, import_react.useState)(defaultCollapsed ?? false);
79
+ const collapsed = outerCollapsed !== void 0 ? outerCollapsed : internalCollapsed;
80
+ const handleCollapse = (0, import_react.useCallback)(() => {
81
+ const newCollapsed = !collapsed;
82
+ if (outerCollapsed === void 0) {
83
+ setInternalCollapsed(newCollapsed);
84
+ }
85
+ onCollapse == null ? void 0 : onCollapse(newCollapsed);
86
+ }, [collapsed, outerCollapsed, onCollapse]);
87
+ const cardTitle = (0, import_react.useMemo)(() => {
88
+ if (!collapsible) {
89
+ return title;
90
+ }
91
+ if (!title) {
92
+ return null;
93
+ }
94
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
95
+ "div",
96
+ {
97
+ className: `${prefixCls}-title-wrapper`,
98
+ onClick: handleCollapse,
99
+ style: { cursor: "pointer", display: "flex", alignItems: "center" },
100
+ children: [
101
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
102
+ import_icons.CaretRightFilled,
103
+ {
104
+ className: `${prefixCls}-collapsible-icon`,
105
+ style: {
106
+ transition: `transform ${token.motionDurationMid}`,
107
+ transform: collapsed ? void 0 : "rotate(90deg)",
108
+ color: token.colorIcon,
109
+ marginRight: token.marginXS
110
+ }
111
+ }
112
+ ),
113
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: title })
114
+ ]
115
+ }
116
+ );
117
+ }, [collapsible, title, collapsed, prefixCls, token, handleCollapse]);
66
118
  const noBodyHorizontalPadding = (0, import_util2.isHorizontalPaddingZero)(bodyStyle == null ? void 0 : bodyStyle.padding) || (0, import_util2.isHorizontalPaddingZero)((_a = styles == null ? void 0 : styles.body) == null ? void 0 : _a.padding);
67
119
  const cardCls = (0, import_classnames.default)(
68
120
  {
69
121
  [`${prefixCls}-has-title`]: !!title,
70
122
  [`${prefixCls}-no-divider`]: !divided,
71
- [`${prefixCls}-no-body-horizontal-padding`]: noBodyHorizontalPadding
123
+ [`${prefixCls}-no-body-horizontal-padding`]: noBodyHorizontalPadding,
124
+ [`${prefixCls}-collapsible`]: collapsible,
125
+ [`${prefixCls}-collapsed`]: collapsed
72
126
  },
73
127
  className
74
128
  );
@@ -90,16 +144,19 @@ var Card = import_react.default.forwardRef(
90
144
  {
91
145
  ref,
92
146
  size,
93
- title,
147
+ title: cardTitle,
94
148
  tabList: newTabList,
95
149
  tabProps: {
96
150
  size: "middle",
97
151
  ...tabProps
98
152
  },
99
153
  prefixCls: customizePrefixCls,
100
- bodyStyle,
154
+ bodyStyle: {
155
+ ...bodyStyle
156
+ },
101
157
  styles,
102
158
  className: cardCls,
159
+ extra,
103
160
  ...restProps,
104
161
  children
105
162
  }
@@ -59,6 +59,9 @@ var genCardStyle = (token) => {
59
59
  const tableComponentCls = `${antCls}-table`;
60
60
  return {
61
61
  [`${componentCls}`]: {
62
+ [`${componentCls}-body`]: {
63
+ paddingTop: token.padding
64
+ },
62
65
  // nested Card style
63
66
  [`${componentCls}:not(${componentCls}-bordered):not(${componentCls}-type-inner)`]: {
64
67
  boxShadow: "none"
@@ -78,6 +81,8 @@ var genCardStyle = (token) => {
78
81
  [`${componentCls}-head`]: {
79
82
  // should not remove border-bottom to avoid tabs inkbar display correctly
80
83
  borderBottomColor: "transparent",
84
+ paddingTop: token.paddingLG,
85
+ paddingBottom: token.padding,
81
86
  // remove divider for top and bottom tabs
82
87
  [tabsComponentCls]: {
83
88
  [`&${tabsComponentCls}-top, &${tabsComponentCls}-bottom`]: {
@@ -93,6 +98,11 @@ var genCardStyle = (token) => {
93
98
  padding: `0 ${paddingLG}px ${paddingLG}px ${paddingLG}px`
94
99
  }
95
100
  },
101
+ [`${componentCls}-small`]: {
102
+ [`${componentCls}-body`]: {
103
+ paddingTop: token.paddingXS
104
+ }
105
+ },
96
106
  [`${componentCls}-small${componentCls}-no-divider:not(${componentCls}-contain-tabs)`]: {
97
107
  [`${componentCls}-body`]: {
98
108
  padding: `0 ${paddingSM}px ${paddingSM}px ${paddingSM}px`
@@ -104,11 +114,20 @@ var genCardStyle = (token) => {
104
114
  }
105
115
  },
106
116
  [`${componentCls}${componentCls}-contain-tabs`]: {
107
- [`${componentCls}-head`]: (0, import_style.genTabsStyle)({
108
- ...token,
109
- componentCls: tabsComponentCls,
110
- prefixCls: tabsPrefixCls
111
- })
117
+ [`${componentCls}-head`]: {
118
+ ...(0, import_style.genTabsStyle)({
119
+ ...token,
120
+ componentCls: tabsComponentCls,
121
+ prefixCls: tabsPrefixCls
122
+ }),
123
+ [tabsComponentCls]: {
124
+ [`&${tabsComponentCls}-top, &${tabsComponentCls}-bottom`]: {
125
+ [`${tabsComponentCls}-tab`]: {
126
+ paddingBlock: token.padding
127
+ }
128
+ }
129
+ }
130
+ }
112
131
  },
113
132
  [`${componentCls}${componentCls}-contain-grid`]: {
114
133
  [`${componentCls}-head`]: {
@@ -133,7 +152,34 @@ var genCardStyle = (token) => {
133
152
  // no body horizontal padding card
134
153
  [`${componentCls}${componentCls}-no-body-horizontal-padding`]: genTableStyle(paddingLG, token),
135
154
  // no body horizontal padding small card
136
- [`${componentCls}${componentCls}-no-body-horizontal-padding${componentCls}-small`]: genTableStyle(paddingSM, token)
155
+ [`${componentCls}${componentCls}-no-body-horizontal-padding${componentCls}-small`]: genTableStyle(paddingSM, token),
156
+ // collapsible card style
157
+ [`${componentCls}${componentCls}-collapsible`]: {
158
+ [`${componentCls}-title-wrapper`]: {
159
+ userSelect: "none",
160
+ [`${componentCls}-collapsible-icon`]: {
161
+ fontSize: token.fontSizeLG
162
+ }
163
+ },
164
+ [`${componentCls}-body`]: {
165
+ overflow: "hidden"
166
+ }
167
+ },
168
+ [`${componentCls}${componentCls}-collapsible${componentCls}-collapsed`]: {
169
+ [`${componentCls}-body`]: {
170
+ maxHeight: 0,
171
+ paddingTop: 0,
172
+ paddingBottom: 0,
173
+ opacity: 0,
174
+ overflow: "hidden",
175
+ border: "none",
176
+ margin: 0
177
+ },
178
+ // hide bottom border of head when collapsed, avoid double border
179
+ [`${componentCls}-head`]: {
180
+ borderBottom: "none"
181
+ }
182
+ }
137
183
  };
138
184
  };
139
185
  var style_default = (prefixCls, tabsPrefixCls) => {
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { ConfigProvider as AntConfigProvider } from 'antd';
3
3
  import type { ConfigProviderProps as AntConfigProviderProps, ConfigConsumerProps as AntConfigConsumerProps, ThemeConfig as AntThemeConfig } from 'antd/es/config-provider';
4
- import type { ComponentStyleConfig, CardConfig as AntCardConfig } from 'antd/es/config-provider/context';
4
+ import type { ComponentStyleConfig, CardConfig as AntCardConfig, TableConfig as AntTableConfig } from 'antd/es/config-provider/context';
5
5
  import type { AppProps } from 'antd/es/app';
6
6
  import type { PaginationConfig } from 'antd/es/pagination';
7
7
  import type { SpinIndicator } from 'antd/es/spin';
@@ -23,7 +23,7 @@ export type CardConfig = AntCardConfig & {
23
23
  export type SpinConfig = ComponentStyleConfig & {
24
24
  indicator?: SpinIndicator;
25
25
  };
26
- export type TableConfig = ComponentStyleConfig & {
26
+ export type TableConfig = AntTableConfig & {
27
27
  selectionColumnWidth?: number;
28
28
  };
29
29
  export interface ConfigConsumerProps extends AntConfigConsumerProps {