@oceanbase/design 1.0.0-alpha.3 → 1.0.0-alpha.5
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/alert/index.d.ts +2 -2
- package/es/alert/index.js +16 -4
- package/es/alert/style/index.js +155 -60
- package/es/badge/index.js +2 -3
- package/es/badge/style/index.js +1 -3
- package/es/card/index.d.ts +4 -0
- package/es/card/index.js +64 -7
- package/es/card/style/index.js +36 -10
- package/es/checkbox/style/index.js +4 -2
- package/es/config-provider/index.d.ts +2 -2
- package/es/config-provider/index.js +26 -2
- package/es/descriptions/hooks/useItems.d.ts +6 -6
- package/es/descriptions/style/index.js +3 -2
- package/es/drawer/style/index.js +28 -8
- package/es/empty/style/index.js +6 -4
- package/es/form/FormItem.d.ts +1 -0
- package/es/form/FormItem.js +14 -4
- package/es/form/style/index.js +15 -3
- package/es/input-number/index.d.ts +2 -1
- package/es/locale/ja-JP.d.ts +3 -0
- package/es/locale/ja-JP.js +28 -0
- package/es/modal/Modal.js +20 -6
- package/es/modal/style/index.js +64 -20
- package/es/radio/style/index.js +4 -2
- package/es/slider/style/index.js +7 -5
- package/es/spin/style/index.js +14 -11
- package/es/static-function/index.js +13 -4
- package/es/table/style/index.js +19 -19
- package/es/tabs/style/index.js +4 -2
- package/es/tag/index.d.ts +1 -0
- package/es/tag/index.js +3 -2
- package/es/tag/style/index.js +8 -2
- package/es/theme/default.js +9 -3
- package/es/theme/style/compact.less +7 -7
- package/es/theme/style/default.less +7 -7
- package/es/typography/style/index.js +25 -20
- package/lib/alert/index.d.ts +2 -2
- package/lib/alert/index.js +13 -3
- package/lib/alert/style/index.js +171 -72
- package/lib/badge/index.js +2 -2
- package/lib/badge/style/index.js +1 -3
- package/lib/card/index.d.ts +4 -0
- package/lib/card/index.js +61 -4
- package/lib/card/style/index.js +58 -11
- package/lib/checkbox/style/index.js +3 -2
- package/lib/config-provider/index.d.ts +2 -2
- package/lib/config-provider/index.js +35 -2
- package/lib/descriptions/hooks/useItems.d.ts +6 -6
- package/lib/descriptions/style/index.js +2 -2
- package/lib/drawer/style/index.js +28 -6
- package/lib/empty/style/index.js +5 -4
- package/lib/form/FormItem.d.ts +1 -0
- package/lib/form/FormItem.js +10 -2
- package/lib/form/style/index.js +20 -1
- package/lib/input-number/index.d.ts +2 -1
- package/lib/locale/ja-JP.d.ts +3 -0
- package/lib/locale/ja-JP.js +60 -0
- package/lib/modal/Modal.js +26 -6
- package/lib/modal/style/index.js +78 -18
- package/lib/radio/style/index.js +3 -2
- package/lib/slider/style/index.js +6 -5
- package/lib/spin/style/index.js +12 -11
- package/lib/static-function/index.js +7 -1
- package/lib/table/style/index.js +19 -19
- package/lib/tabs/style/index.js +5 -0
- package/lib/tag/index.d.ts +1 -0
- package/lib/tag/index.js +3 -1
- package/lib/tag/style/index.js +8 -0
- package/lib/theme/default.js +9 -3
- package/lib/theme/style/compact.less +7 -7
- package/lib/theme/style/default.less +7 -7
- package/lib/typography/style/index.js +24 -20
- package/package.json +5 -6
package/lib/alert/style/index.js
CHANGED
|
@@ -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
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
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
|
-
|
|
49
|
+
a: linkStyle
|
|
51
50
|
},
|
|
52
|
-
[`${componentCls}-
|
|
53
|
-
|
|
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
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
colorInfoHover,
|
|
75
|
-
colorWarning,
|
|
76
|
-
colorWarningHover,
|
|
77
|
-
colorError,
|
|
78
|
-
colorErrorHover,
|
|
79
|
-
colorIcon,
|
|
80
|
-
colorIconHover,
|
|
81
|
-
motionDurationMid
|
|
82
|
-
} = token;
|
|
83
|
-
const height = token.fontSize * token.lineHeight;
|
|
57
|
+
const { componentCls, colorIcon, colorIconHover, motionDurationMid, calc } = token;
|
|
58
|
+
const height = calc(token.fontSize).mul(token.lineHeight).equal();
|
|
59
|
+
const iconWidth = token.fontSizeLG;
|
|
60
|
+
const contentStartOffset = calc(iconWidth).add(token.marginXS).equal();
|
|
61
|
+
const closeIconWidth = height;
|
|
84
62
|
return {
|
|
85
63
|
[`${componentCls}`]: {
|
|
86
64
|
// vertical align to flex-start
|
|
87
65
|
alignItems: "flex-start !important",
|
|
88
|
-
|
|
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
|
-
|
|
105
|
+
flexWrap: "wrap",
|
|
106
|
+
[`${componentCls}-content`]: {
|
|
107
|
+
flex: `1 1 ${calc("100%").sub(contentStartOffset).sub(closeIconWidth).sub(token.padding).equal()}`,
|
|
108
|
+
minWidth: 0,
|
|
109
|
+
maxWidth: calc("100%").sub(contentStartOffset).sub(closeIconWidth).sub(token.padding).equal(),
|
|
110
|
+
wordBreak: "break-word"
|
|
111
|
+
},
|
|
112
|
+
[`${componentCls}-action`]: {
|
|
113
|
+
width: calc("100%").sub(contentStartOffset).sub(token.padding).equal(),
|
|
114
|
+
marginInlineStart: contentStartOffset,
|
|
115
|
+
marginTop: token.marginXS
|
|
116
|
+
}
|
|
103
117
|
},
|
|
104
118
|
[`${componentCls}${componentCls}-with-description`]: {
|
|
105
|
-
paddingBlock: token.
|
|
119
|
+
paddingBlock: token.paddingSM,
|
|
120
|
+
flexWrap: "wrap",
|
|
106
121
|
[`${componentCls}-message`]: {
|
|
107
|
-
|
|
108
|
-
|
|
122
|
+
fontSize: token.fontSize,
|
|
123
|
+
fontWeight: token.fontWeightStrong,
|
|
124
|
+
marginBottom: token.marginXXS,
|
|
125
|
+
wordBreak: "break-word"
|
|
109
126
|
},
|
|
110
127
|
[`${componentCls}-description`]: {
|
|
111
|
-
|
|
128
|
+
wordBreak: "break-word"
|
|
112
129
|
},
|
|
113
|
-
[`${componentCls}-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
130
|
+
[`${componentCls}-content`]: {
|
|
131
|
+
flex: `1 1 ${calc("100%").sub(contentStartOffset).sub(closeIconWidth).sub(token.padding).equal()}`,
|
|
132
|
+
minWidth: 0,
|
|
133
|
+
maxWidth: calc("100%").sub(contentStartOffset).sub(closeIconWidth).sub(token.padding).equal(),
|
|
134
|
+
wordBreak: "break-word"
|
|
117
135
|
},
|
|
118
136
|
[`${componentCls}-action`]: {
|
|
119
|
-
|
|
137
|
+
width: calc("100%").sub(contentStartOffset).sub(token.padding).equal(),
|
|
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:
|
|
148
|
+
padding: "0px !important",
|
|
132
149
|
borderRadius: 0
|
|
133
150
|
},
|
|
134
|
-
[`${componentCls}-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
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
|
};
|
package/lib/badge/index.js
CHANGED
|
@@ -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
|
|
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
|
-
|
|
57
|
+
spin: true
|
|
58
58
|
}
|
|
59
59
|
),
|
|
60
60
|
success: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons.CheckCircleFilled, {}),
|
package/lib/badge/style/index.js
CHANGED
|
@@ -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`]: {
|
package/lib/card/index.d.ts
CHANGED
|
@@ -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 {
|
|
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
|
}
|
package/lib/card/style/index.js
CHANGED
|
@@ -24,6 +24,7 @@ __export(style_exports, {
|
|
|
24
24
|
genTableStyle: () => genTableStyle
|
|
25
25
|
});
|
|
26
26
|
module.exports = __toCommonJS(style_exports);
|
|
27
|
+
var import_cssinjs = require("@ant-design/cssinjs");
|
|
27
28
|
var import_style = require("../../tabs/style");
|
|
28
29
|
var import_genComponentStyleHook = require("../../_util/genComponentStyleHook");
|
|
29
30
|
var genTableStyle = (padding, token) => {
|
|
@@ -55,17 +56,20 @@ var genTableStyle = (padding, token) => {
|
|
|
55
56
|
};
|
|
56
57
|
};
|
|
57
58
|
var genCardStyle = (token) => {
|
|
58
|
-
const { componentCls, antCls, tabsComponentCls, tabsPrefixCls, paddingSM, paddingLG } = token;
|
|
59
|
+
const { componentCls, antCls, tabsComponentCls, tabsPrefixCls, paddingSM, paddingLG, calc } = token;
|
|
59
60
|
const tableComponentCls = `${antCls}-table`;
|
|
60
61
|
return {
|
|
61
62
|
[`${componentCls}`]: {
|
|
63
|
+
[`${componentCls}-body`]: {
|
|
64
|
+
paddingTop: token.padding
|
|
65
|
+
},
|
|
62
66
|
// nested Card style
|
|
63
67
|
[`${componentCls}:not(${componentCls}-bordered):not(${componentCls}-type-inner)`]: {
|
|
64
68
|
boxShadow: "none"
|
|
65
69
|
},
|
|
66
70
|
// nested and bordered Card radius
|
|
67
71
|
[`${componentCls}${componentCls}-bordered`]: {
|
|
68
|
-
borderRadius: token.borderRadiusLG
|
|
72
|
+
borderRadius: calc(token.borderRadiusLG).sub(2).equal(),
|
|
69
73
|
[`${componentCls}${componentCls}-bordered`]: {
|
|
70
74
|
borderRadius: token.borderRadius,
|
|
71
75
|
[`${componentCls}${componentCls}-bordered`]: {
|
|
@@ -78,6 +82,8 @@ var genCardStyle = (token) => {
|
|
|
78
82
|
[`${componentCls}-head`]: {
|
|
79
83
|
// should not remove border-bottom to avoid tabs inkbar display correctly
|
|
80
84
|
borderBottomColor: "transparent",
|
|
85
|
+
paddingTop: token.paddingLG,
|
|
86
|
+
paddingBottom: token.padding,
|
|
81
87
|
// remove divider for top and bottom tabs
|
|
82
88
|
[tabsComponentCls]: {
|
|
83
89
|
[`&${tabsComponentCls}-top, &${tabsComponentCls}-bottom`]: {
|
|
@@ -90,12 +96,17 @@ var genCardStyle = (token) => {
|
|
|
90
96
|
},
|
|
91
97
|
[`${componentCls}${componentCls}-no-divider:not(${componentCls}-contain-tabs)`]: {
|
|
92
98
|
[`${componentCls}-body`]: {
|
|
93
|
-
padding: `0 ${paddingLG}
|
|
99
|
+
padding: `0 ${(0, import_cssinjs.unit)(paddingLG)} ${(0, import_cssinjs.unit)(paddingLG)} ${(0, import_cssinjs.unit)(paddingLG)}`
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
[`${componentCls}-small`]: {
|
|
103
|
+
[`${componentCls}-body`]: {
|
|
104
|
+
paddingTop: token.paddingXS
|
|
94
105
|
}
|
|
95
106
|
},
|
|
96
107
|
[`${componentCls}-small${componentCls}-no-divider:not(${componentCls}-contain-tabs)`]: {
|
|
97
108
|
[`${componentCls}-body`]: {
|
|
98
|
-
padding: `0 ${paddingSM}
|
|
109
|
+
padding: `0 ${(0, import_cssinjs.unit)(paddingSM)} ${(0, import_cssinjs.unit)(paddingSM)} ${(0, import_cssinjs.unit)(paddingSM)}`
|
|
99
110
|
}
|
|
100
111
|
},
|
|
101
112
|
[`${componentCls}-small${componentCls}-contain-tabs >${componentCls}-head`]: {
|
|
@@ -104,11 +115,20 @@ var genCardStyle = (token) => {
|
|
|
104
115
|
}
|
|
105
116
|
},
|
|
106
117
|
[`${componentCls}${componentCls}-contain-tabs`]: {
|
|
107
|
-
[`${componentCls}-head`]:
|
|
108
|
-
...
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
118
|
+
[`${componentCls}-head`]: {
|
|
119
|
+
...(0, import_style.genTabsStyle)({
|
|
120
|
+
...token,
|
|
121
|
+
componentCls: tabsComponentCls,
|
|
122
|
+
prefixCls: tabsPrefixCls
|
|
123
|
+
}),
|
|
124
|
+
[tabsComponentCls]: {
|
|
125
|
+
[`&${tabsComponentCls}-top, &${tabsComponentCls}-bottom`]: {
|
|
126
|
+
[`${tabsComponentCls}-tab`]: {
|
|
127
|
+
paddingBlock: token.padding
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
112
132
|
},
|
|
113
133
|
[`${componentCls}${componentCls}-contain-grid`]: {
|
|
114
134
|
[`${componentCls}-head`]: {
|
|
@@ -126,14 +146,41 @@ var genCardStyle = (token) => {
|
|
|
126
146
|
[`&${componentCls}-has-title${componentCls}-no-divider:not(${componentCls}-contain-tabs)`]: {
|
|
127
147
|
[`${componentCls}-body`]: {
|
|
128
148
|
[`& > ${tableComponentCls}-wrapper ${tableComponentCls}:not(${tableComponentCls}-bordered):first-child`]: {
|
|
129
|
-
marginTop:
|
|
149
|
+
marginTop: calc(token.marginSM).mul(-1).equal()
|
|
130
150
|
}
|
|
131
151
|
}
|
|
132
152
|
},
|
|
133
153
|
// no body horizontal padding card
|
|
134
154
|
[`${componentCls}${componentCls}-no-body-horizontal-padding`]: genTableStyle(paddingLG, token),
|
|
135
155
|
// no body horizontal padding small card
|
|
136
|
-
[`${componentCls}${componentCls}-no-body-horizontal-padding${componentCls}-small`]: genTableStyle(paddingSM, token)
|
|
156
|
+
[`${componentCls}${componentCls}-no-body-horizontal-padding${componentCls}-small`]: genTableStyle(paddingSM, token),
|
|
157
|
+
// collapsible card style
|
|
158
|
+
[`${componentCls}${componentCls}-collapsible`]: {
|
|
159
|
+
[`${componentCls}-title-wrapper`]: {
|
|
160
|
+
userSelect: "none",
|
|
161
|
+
[`${componentCls}-collapsible-icon`]: {
|
|
162
|
+
fontSize: token.fontSizeLG
|
|
163
|
+
}
|
|
164
|
+
},
|
|
165
|
+
[`${componentCls}-body`]: {
|
|
166
|
+
overflow: "hidden"
|
|
167
|
+
}
|
|
168
|
+
},
|
|
169
|
+
[`${componentCls}${componentCls}-collapsible${componentCls}-collapsed`]: {
|
|
170
|
+
[`${componentCls}-body`]: {
|
|
171
|
+
maxHeight: 0,
|
|
172
|
+
paddingTop: 0,
|
|
173
|
+
paddingBottom: 0,
|
|
174
|
+
opacity: 0,
|
|
175
|
+
overflow: "hidden",
|
|
176
|
+
border: "none",
|
|
177
|
+
margin: 0
|
|
178
|
+
},
|
|
179
|
+
// hide bottom border of head when collapsed, avoid double border
|
|
180
|
+
[`${componentCls}-head`]: {
|
|
181
|
+
borderBottom: "none"
|
|
182
|
+
}
|
|
183
|
+
}
|
|
137
184
|
};
|
|
138
185
|
};
|
|
139
186
|
var style_default = (prefixCls, tabsPrefixCls) => {
|
|
@@ -25,13 +25,14 @@ __export(style_exports, {
|
|
|
25
25
|
module.exports = __toCommonJS(style_exports);
|
|
26
26
|
var import_genComponentStyleHook = require("../../_util/genComponentStyleHook");
|
|
27
27
|
var genCheckboxStyle = (token) => {
|
|
28
|
-
const { componentCls, fontSize, fontSizeLG, lineHeight } = token;
|
|
28
|
+
const { componentCls, fontSize, fontSizeLG, lineHeight, calc } = token;
|
|
29
|
+
const translateY = calc(calc(fontSize).mul(lineHeight).equal()).sub(fontSizeLG).div(2).equal();
|
|
29
30
|
return {
|
|
30
31
|
[`${componentCls}-wrapper`]: {
|
|
31
32
|
[`${componentCls}`]: {
|
|
32
33
|
alignSelf: "baseline",
|
|
33
34
|
[`${componentCls}-inner`]: {
|
|
34
|
-
transform: `translate(0px, ${
|
|
35
|
+
transform: `translate(0px, ${translateY})`
|
|
35
36
|
}
|
|
36
37
|
}
|
|
37
38
|
}
|
|
@@ -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 =
|
|
26
|
+
export type TableConfig = AntTableConfig & {
|
|
27
27
|
selectionColumnWidth?: number;
|
|
28
28
|
};
|
|
29
29
|
export interface ConfigConsumerProps extends AntConfigConsumerProps {
|
|
@@ -103,7 +103,18 @@ var ConfigProvider = ({
|
|
|
103
103
|
collapse: (0, import_lodash.merge)(
|
|
104
104
|
{},
|
|
105
105
|
{
|
|
106
|
-
expandIcon: ({ isActive }) =>
|
|
106
|
+
expandIcon: ({ isActive }) => {
|
|
107
|
+
var _a2, _b2;
|
|
108
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
109
|
+
import_icons.CaretRightOutlined,
|
|
110
|
+
{
|
|
111
|
+
rotate: isActive ? 90 : 0,
|
|
112
|
+
style: {
|
|
113
|
+
color: ((_a2 = mergedTheme.token) == null ? void 0 : _a2.colorIcon) || ((_b2 = mergedTheme.token) == null ? void 0 : _b2.colorTextSecondary)
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
);
|
|
117
|
+
}
|
|
107
118
|
},
|
|
108
119
|
parentContext.collapse,
|
|
109
120
|
collapse
|
|
@@ -117,7 +128,29 @@ var ConfigProvider = ({
|
|
|
117
128
|
form
|
|
118
129
|
),
|
|
119
130
|
spin: (0, import_lodash.merge)({}, parentContext.spin, spin),
|
|
120
|
-
table: (0, import_lodash.merge)(
|
|
131
|
+
table: (0, import_lodash.merge)(
|
|
132
|
+
{},
|
|
133
|
+
{
|
|
134
|
+
expandable: {
|
|
135
|
+
expandIcon: ({ expandable, expanded, onExpand, record }) => {
|
|
136
|
+
var _a2, _b2;
|
|
137
|
+
return expandable && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
138
|
+
import_icons.CaretRightOutlined,
|
|
139
|
+
{
|
|
140
|
+
onClick: (e) => onExpand(record, e),
|
|
141
|
+
style: {
|
|
142
|
+
transition: `transform 0.2s`,
|
|
143
|
+
transform: expanded ? "rotate(90deg)" : void 0,
|
|
144
|
+
color: ((_a2 = mergedTheme.token) == null ? void 0 : _a2.colorIcon) || ((_b2 = mergedTheme.token) == null ? void 0 : _b2.colorTextSecondary)
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
},
|
|
151
|
+
parentContext.table,
|
|
152
|
+
table
|
|
153
|
+
),
|
|
121
154
|
tabs: (0, import_lodash.merge)({}, parentContext.tabs, tabs),
|
|
122
155
|
theme: (0, import_lodash.merge)({}, mergedTheme, {
|
|
123
156
|
token: {
|
|
@@ -5,17 +5,17 @@ export default function useItems(items?: DescriptionsItemType[], children?: Reac
|
|
|
5
5
|
key?: React.Key;
|
|
6
6
|
label?: React.ReactNode;
|
|
7
7
|
span?: number | "filled" | {
|
|
8
|
-
xs?: number;
|
|
9
|
-
sm?: number;
|
|
10
|
-
md?: number;
|
|
11
|
-
lg?: number;
|
|
12
|
-
xl?: number;
|
|
13
8
|
xxl?: number;
|
|
9
|
+
xl?: number;
|
|
10
|
+
lg?: number;
|
|
11
|
+
md?: number;
|
|
12
|
+
sm?: number;
|
|
13
|
+
xs?: number;
|
|
14
14
|
};
|
|
15
15
|
style?: React.CSSProperties;
|
|
16
|
+
className?: string;
|
|
16
17
|
classNames?: Partial<Record<"label" | "content", string>>;
|
|
17
18
|
styles?: Partial<Record<"label" | "content", React.CSSProperties>>;
|
|
18
|
-
className?: string;
|
|
19
19
|
labelStyle?: React.CSSProperties;
|
|
20
20
|
contentStyle?: React.CSSProperties;
|
|
21
21
|
}[];
|