@oceanbase/design 1.0.0-alpha.8 → 1.0.0-alpha.9
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/card/index.d.ts +2 -0
- package/es/card/index.js +33 -13
- package/es/card/style/index.js +36 -20
- package/es/checkbox/style/index.js +5 -3
- package/es/config-provider/index.js +3 -1
- package/es/descriptions/hooks/useItems.d.ts +9 -9
- package/es/descriptions/index.d.ts +10 -0
- package/es/descriptions/index.js +59 -3
- package/es/descriptions/style/index.js +48 -5
- package/es/drawer/style/index.js +11 -5
- package/es/slider/style/index.js +3 -2
- package/es/style/cssVariables.d.ts +25 -0
- package/es/style/cssVariables.js +48 -0
- package/es/style/cssVariablesMeta.d.ts +24 -0
- package/es/style/cssVariablesMeta.js +974 -0
- package/es/table/index.js +8 -0
- package/es/table/style/index.js +9 -3
- package/es/tag/style/index.js +1 -1
- package/es/theme/default.d.ts +44 -0
- package/es/theme/default.js +159 -40
- package/es/theme/interface.d.ts +43 -0
- package/es/theme/style/compact.less +43 -24
- package/es/theme/style/default.less +43 -24
- package/lib/card/index.d.ts +2 -0
- package/lib/card/index.js +27 -12
- package/lib/card/style/index.js +61 -29
- package/lib/checkbox/style/index.js +4 -3
- package/lib/config-provider/index.js +3 -0
- package/lib/descriptions/hooks/useItems.d.ts +9 -9
- package/lib/descriptions/index.d.ts +10 -0
- package/lib/descriptions/index.js +49 -2
- package/lib/descriptions/style/index.js +85 -4
- package/lib/drawer/style/index.js +9 -4
- package/lib/slider/style/index.js +5 -2
- package/lib/style/cssVariables.d.ts +25 -0
- package/lib/style/cssVariables.js +261 -0
- package/lib/style/cssVariablesMeta.d.ts +24 -0
- package/lib/style/cssVariablesMeta.js +1059 -0
- package/lib/table/index.js +7 -0
- package/lib/table/style/index.js +10 -1
- package/lib/tag/style/index.js +1 -1
- package/lib/theme/default.d.ts +44 -0
- package/lib/theme/default.js +232 -42
- package/lib/theme/interface.d.ts +43 -0
- package/lib/theme/style/compact.less +43 -24
- package/lib/theme/style/default.less +43 -24
- package/package.json +2 -2
package/lib/card/index.d.ts
CHANGED
|
@@ -6,7 +6,9 @@ export interface CardTabListType extends AntCardTabListType {
|
|
|
6
6
|
tag?: React.ReactNode;
|
|
7
7
|
}
|
|
8
8
|
export interface CardProps extends AntCardProps {
|
|
9
|
+
subTitle?: React.ReactNode;
|
|
9
10
|
divided?: boolean;
|
|
11
|
+
gray?: boolean;
|
|
10
12
|
tabList?: CardTabListType[];
|
|
11
13
|
collapsible?: boolean;
|
|
12
14
|
defaultCollapsed?: boolean;
|
package/lib/card/index.js
CHANGED
|
@@ -50,9 +50,13 @@ var Card = import_react.default.forwardRef(
|
|
|
50
50
|
children,
|
|
51
51
|
size,
|
|
52
52
|
title,
|
|
53
|
+
subTitle,
|
|
54
|
+
extra,
|
|
53
55
|
tabList,
|
|
54
56
|
tabProps,
|
|
57
|
+
tabBarExtraContent,
|
|
55
58
|
divided: outerDivided,
|
|
59
|
+
gray,
|
|
56
60
|
prefixCls: customizePrefixCls,
|
|
57
61
|
bodyStyle,
|
|
58
62
|
styles,
|
|
@@ -61,15 +65,10 @@ var Card = import_react.default.forwardRef(
|
|
|
61
65
|
defaultCollapsed,
|
|
62
66
|
collapsed: outerCollapsed,
|
|
63
67
|
onCollapse,
|
|
64
|
-
extra,
|
|
65
68
|
...restProps
|
|
66
69
|
}, ref) => {
|
|
67
70
|
var _a;
|
|
68
|
-
const {
|
|
69
|
-
getPrefixCls,
|
|
70
|
-
card: contextCard,
|
|
71
|
-
iconPrefixCls
|
|
72
|
-
} = (0, import_react.useContext)(import_config_provider.default.ConfigContext);
|
|
71
|
+
const { getPrefixCls, card: contextCard } = (0, import_react.useContext)(import_config_provider.default.ConfigContext);
|
|
73
72
|
const { token } = import_theme.default.useToken();
|
|
74
73
|
const divided = outerDivided ?? (contextCard == null ? void 0 : contextCard.divided) ?? true;
|
|
75
74
|
const prefixCls = getPrefixCls("card", customizePrefixCls);
|
|
@@ -85,12 +84,26 @@ var Card = import_react.default.forwardRef(
|
|
|
85
84
|
onCollapse == null ? void 0 : onCollapse(newCollapsed);
|
|
86
85
|
}, [collapsed, outerCollapsed, onCollapse]);
|
|
87
86
|
const cardTitle = (0, import_react.useMemo)(() => {
|
|
88
|
-
if (!collapsible) {
|
|
87
|
+
if (!collapsible && !subTitle) {
|
|
89
88
|
return title;
|
|
90
89
|
}
|
|
91
90
|
if (!title) {
|
|
92
91
|
return null;
|
|
93
92
|
}
|
|
93
|
+
const titleContent = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
94
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: title }),
|
|
95
|
+
subTitle && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: `${prefixCls}-sub-title`, children: subTitle })
|
|
96
|
+
] });
|
|
97
|
+
if (!collapsible) {
|
|
98
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
99
|
+
"div",
|
|
100
|
+
{
|
|
101
|
+
className: `${prefixCls}-title-wrapper`,
|
|
102
|
+
style: { display: "flex", alignItems: "center" },
|
|
103
|
+
children: titleContent
|
|
104
|
+
}
|
|
105
|
+
);
|
|
106
|
+
}
|
|
94
107
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
95
108
|
"div",
|
|
96
109
|
{
|
|
@@ -110,16 +123,17 @@ var Card = import_react.default.forwardRef(
|
|
|
110
123
|
}
|
|
111
124
|
}
|
|
112
125
|
),
|
|
113
|
-
|
|
126
|
+
titleContent
|
|
114
127
|
]
|
|
115
128
|
}
|
|
116
129
|
);
|
|
117
|
-
}, [collapsible, title, collapsed, prefixCls, token, handleCollapse]);
|
|
130
|
+
}, [collapsible, title, subTitle, collapsed, prefixCls, token, handleCollapse]);
|
|
118
131
|
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);
|
|
119
132
|
const cardCls = (0, import_classnames.default)(
|
|
120
133
|
{
|
|
121
|
-
[`${prefixCls}-has-
|
|
134
|
+
[`${prefixCls}-has-head`]: !!(title || extra || tabList || tabBarExtraContent),
|
|
122
135
|
[`${prefixCls}-no-divider`]: !divided,
|
|
136
|
+
[`${prefixCls}-gray`]: gray,
|
|
123
137
|
[`${prefixCls}-no-body-horizontal-padding`]: noBodyHorizontalPadding,
|
|
124
138
|
[`${prefixCls}-collapsible`]: collapsible,
|
|
125
139
|
[`${prefixCls}-collapsed`]: collapsed
|
|
@@ -145,9 +159,11 @@ var Card = import_react.default.forwardRef(
|
|
|
145
159
|
ref,
|
|
146
160
|
size,
|
|
147
161
|
title: cardTitle,
|
|
162
|
+
extra,
|
|
148
163
|
tabList: newTabList,
|
|
164
|
+
tabBarExtraContent,
|
|
149
165
|
tabProps: {
|
|
150
|
-
size: "middle",
|
|
166
|
+
size: size === "small" ? "small" : "middle",
|
|
151
167
|
...tabProps
|
|
152
168
|
},
|
|
153
169
|
prefixCls: customizePrefixCls,
|
|
@@ -156,7 +172,6 @@ var Card = import_react.default.forwardRef(
|
|
|
156
172
|
},
|
|
157
173
|
styles,
|
|
158
174
|
className: cardCls,
|
|
159
|
-
extra,
|
|
160
175
|
...restProps,
|
|
161
176
|
children
|
|
162
177
|
}
|
package/lib/card/style/index.js
CHANGED
|
@@ -24,7 +24,6 @@ __export(style_exports, {
|
|
|
24
24
|
genTableStyle: () => genTableStyle
|
|
25
25
|
});
|
|
26
26
|
module.exports = __toCommonJS(style_exports);
|
|
27
|
-
var import_cssinjs = require("@ant-design/cssinjs");
|
|
28
27
|
var import_style = require("../../tabs/style");
|
|
29
28
|
var import_genComponentStyleHook = require("../../_util/genComponentStyleHook");
|
|
30
29
|
var genTableStyle = (padding, token) => {
|
|
@@ -60,6 +59,23 @@ var genCardStyle = (token) => {
|
|
|
60
59
|
const tableComponentCls = `${antCls}-table`;
|
|
61
60
|
return {
|
|
62
61
|
[`${componentCls}`]: {
|
|
62
|
+
[`${componentCls}-head`]: {
|
|
63
|
+
// subTitle style
|
|
64
|
+
[`${componentCls}-sub-title`]: {
|
|
65
|
+
marginInlineStart: token.marginXS,
|
|
66
|
+
fontWeight: "normal",
|
|
67
|
+
fontSize: token.fontSize,
|
|
68
|
+
color: token.colorTextDescription
|
|
69
|
+
},
|
|
70
|
+
// remove divider for top and bottom tabs
|
|
71
|
+
[tabsComponentCls]: {
|
|
72
|
+
[`&${tabsComponentCls}-top, &${tabsComponentCls}-bottom`]: {
|
|
73
|
+
[`${tabsComponentCls}-nav::before`]: {
|
|
74
|
+
border: "none"
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
},
|
|
63
79
|
[`${componentCls}-body`]: {
|
|
64
80
|
paddingTop: token.padding
|
|
65
81
|
},
|
|
@@ -78,35 +94,42 @@ var genCardStyle = (token) => {
|
|
|
78
94
|
}
|
|
79
95
|
}
|
|
80
96
|
},
|
|
97
|
+
[`${componentCls}${componentCls}-has-head${componentCls}-no-divider:not(${componentCls}-contain-tabs)`]: {
|
|
98
|
+
[`${componentCls}-body`]: {
|
|
99
|
+
paddingTop: 0
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
[`${componentCls}:not(${componentCls}-has-head)`]: {
|
|
103
|
+
[`${componentCls}-body`]: {
|
|
104
|
+
paddingTop: paddingLG
|
|
105
|
+
}
|
|
106
|
+
},
|
|
81
107
|
[`${componentCls}${componentCls}-no-divider`]: {
|
|
82
108
|
[`${componentCls}-head`]: {
|
|
83
|
-
//
|
|
84
|
-
borderBottomColor: "transparent"
|
|
85
|
-
paddingTop: token.paddingLG,
|
|
86
|
-
paddingBottom: token.padding,
|
|
87
|
-
// remove divider for top and bottom tabs
|
|
88
|
-
[tabsComponentCls]: {
|
|
89
|
-
[`&${tabsComponentCls}-top, &${tabsComponentCls}-bottom`]: {
|
|
90
|
-
[`${tabsComponentCls}-nav::before`]: {
|
|
91
|
-
border: "none"
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
}
|
|
109
|
+
// hide bottom border by setting borderBottomColor to transparent
|
|
110
|
+
borderBottomColor: "transparent"
|
|
95
111
|
}
|
|
96
112
|
},
|
|
97
113
|
[`${componentCls}${componentCls}-no-divider:not(${componentCls}-contain-tabs)`]: {
|
|
98
|
-
[`${componentCls}-
|
|
99
|
-
|
|
114
|
+
[`${componentCls}-head`]: {
|
|
115
|
+
paddingTop: token.paddingLG,
|
|
116
|
+
paddingBottom: token.padding
|
|
100
117
|
}
|
|
101
118
|
},
|
|
102
|
-
[`${componentCls}-small`]: {
|
|
119
|
+
[`${componentCls}${componentCls}-small:not(${componentCls}-has-head)`]: {
|
|
103
120
|
[`${componentCls}-body`]: {
|
|
104
|
-
paddingTop:
|
|
121
|
+
paddingTop: paddingSM
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
[`${componentCls}${componentCls}-small${componentCls}-no-divider:not(${componentCls}-contain-tabs)`]: {
|
|
125
|
+
[`${componentCls}-head`]: {
|
|
126
|
+
paddingTop: token.paddingSM,
|
|
127
|
+
paddingBottom: token.paddingXS
|
|
105
128
|
}
|
|
106
129
|
},
|
|
107
|
-
[`${componentCls}-small
|
|
130
|
+
[`${componentCls}-small`]: {
|
|
108
131
|
[`${componentCls}-body`]: {
|
|
109
|
-
|
|
132
|
+
paddingTop: token.paddingXS
|
|
110
133
|
}
|
|
111
134
|
},
|
|
112
135
|
[`${componentCls}-small${componentCls}-contain-tabs >${componentCls}-head`]: {
|
|
@@ -120,14 +143,7 @@ var genCardStyle = (token) => {
|
|
|
120
143
|
...token,
|
|
121
144
|
componentCls: tabsComponentCls,
|
|
122
145
|
prefixCls: tabsPrefixCls
|
|
123
|
-
})
|
|
124
|
-
[tabsComponentCls]: {
|
|
125
|
-
[`&${tabsComponentCls}-top, &${tabsComponentCls}-bottom`]: {
|
|
126
|
-
[`${tabsComponentCls}-tab`]: {
|
|
127
|
-
paddingBlock: token.padding
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
}
|
|
146
|
+
})
|
|
131
147
|
}
|
|
132
148
|
},
|
|
133
149
|
[`${componentCls}${componentCls}-contain-grid`]: {
|
|
@@ -143,7 +159,7 @@ var genCardStyle = (token) => {
|
|
|
143
159
|
}
|
|
144
160
|
},
|
|
145
161
|
// reduce margin between card title and table
|
|
146
|
-
[`&${componentCls}-has-
|
|
162
|
+
[`&${componentCls}-has-head${componentCls}-no-divider:not(${componentCls}-contain-tabs)`]: {
|
|
147
163
|
[`${componentCls}-body`]: {
|
|
148
164
|
[`& > ${tableComponentCls}-wrapper ${tableComponentCls}:not(${tableComponentCls}-bordered):first-child`]: {
|
|
149
165
|
marginTop: calc(token.marginSM).mul(-1).equal()
|
|
@@ -178,8 +194,24 @@ var genCardStyle = (token) => {
|
|
|
178
194
|
},
|
|
179
195
|
// hide bottom border of head when collapsed, avoid double border
|
|
180
196
|
[`${componentCls}-head`]: {
|
|
181
|
-
|
|
197
|
+
borderBottomColor: "transparent"
|
|
198
|
+
},
|
|
199
|
+
[`&${componentCls}-no-divider`]: {
|
|
200
|
+
[`${componentCls}-head`]: {
|
|
201
|
+
paddingBottom: paddingLG
|
|
202
|
+
}
|
|
203
|
+
},
|
|
204
|
+
[`&${componentCls}-no-divider${componentCls}-small`]: {
|
|
205
|
+
[`${componentCls}-head`]: {
|
|
206
|
+
paddingBottom: paddingSM
|
|
207
|
+
}
|
|
182
208
|
}
|
|
209
|
+
},
|
|
210
|
+
// gray background card style
|
|
211
|
+
[`${componentCls}${componentCls}-gray`]: {
|
|
212
|
+
boxShadow: "none",
|
|
213
|
+
borderRadius: token.borderRadiusMD,
|
|
214
|
+
backgroundColor: token.colorFillQuaternary
|
|
183
215
|
}
|
|
184
216
|
};
|
|
185
217
|
};
|
|
@@ -23,16 +23,17 @@ __export(style_exports, {
|
|
|
23
23
|
genCheckboxStyle: () => genCheckboxStyle
|
|
24
24
|
});
|
|
25
25
|
module.exports = __toCommonJS(style_exports);
|
|
26
|
+
var import_cssinjs = require("@ant-design/cssinjs");
|
|
26
27
|
var import_genComponentStyleHook = require("../../_util/genComponentStyleHook");
|
|
27
28
|
var genCheckboxStyle = (token) => {
|
|
28
|
-
const { componentCls, fontSize,
|
|
29
|
-
const translateY = calc(
|
|
29
|
+
const { componentCls, fontSize, lineHeight, lineWidth, controlInteractiveSize, calc } = token;
|
|
30
|
+
const translateY = calc(fontSize).mul(lineHeight).sub(controlInteractiveSize).sub(lineWidth).div(2).equal();
|
|
30
31
|
return {
|
|
31
32
|
[`${componentCls}-wrapper`]: {
|
|
32
33
|
[`${componentCls}`]: {
|
|
33
34
|
alignSelf: "baseline",
|
|
34
35
|
[`${componentCls}-inner`]: {
|
|
35
|
-
transform: `translate(0px, ${translateY})`
|
|
36
|
+
transform: `translate(0px, ${(0, import_cssinjs.unit)(translateY)})`
|
|
36
37
|
}
|
|
37
38
|
}
|
|
38
39
|
}
|
|
@@ -48,6 +48,7 @@ var import_dark = __toESM(require("../theme/dark"));
|
|
|
48
48
|
var import_compact = __toESM(require("../theme/compact"));
|
|
49
49
|
var import_DefaultRenderEmpty = __toESM(require("./DefaultRenderEmpty"));
|
|
50
50
|
var import_global = __toESM(require("../style/global"));
|
|
51
|
+
var import_cssVariables = __toESM(require("../style/cssVariables"));
|
|
51
52
|
__reExport(config_provider_exports, require("./navigate"), module.exports);
|
|
52
53
|
__reExport(config_provider_exports, require("antd/es/config-provider/context"), module.exports);
|
|
53
54
|
__reExport(config_provider_exports, require("antd/es/config-provider/SizeContext"), module.exports);
|
|
@@ -172,6 +173,7 @@ var ConfigProvider = ({
|
|
|
172
173
|
{
|
|
173
174
|
onClick: (e) => onExpand(record, e),
|
|
174
175
|
style: {
|
|
176
|
+
// marginRight: mergedTheme.token?.marginXS || 8,
|
|
175
177
|
transition: `transform 0.2s`,
|
|
176
178
|
transform: expanded ? "rotate(90deg)" : void 0,
|
|
177
179
|
color: ((_a2 = mergedTheme.token) == null ? void 0 : _a2.colorIcon) || ((_b2 = mergedTheme.token) == null ? void 0 : _b2.colorTextSecondary)
|
|
@@ -229,6 +231,7 @@ var ConfigProvider = ({
|
|
|
229
231
|
injectStaticFunction: false
|
|
230
232
|
},
|
|
231
233
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_cssinjs.StyleProvider, { ...mergedStyleProviderProps, children: [
|
|
234
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_cssVariables.default, {}),
|
|
232
235
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_global.default, { prefixCls: restProps.prefixCls }),
|
|
233
236
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_app.default, { component: false, ...appProps, children: [
|
|
234
237
|
children,
|
|
@@ -3,19 +3,19 @@ import type { DescriptionsItemType } from '..';
|
|
|
3
3
|
export default function useItems(items?: DescriptionsItemType[], children?: React.ReactNode, bordered?: boolean): {
|
|
4
4
|
children: string | number | boolean | Iterable<React.ReactNode> | import("@emotion/react/jsx-runtime").JSX.Element;
|
|
5
5
|
key?: React.Key;
|
|
6
|
+
classNames?: Partial<Record<"content" | "label", string>>;
|
|
7
|
+
styles?: Partial<Record<"content" | "label", React.CSSProperties>>;
|
|
8
|
+
className?: string;
|
|
9
|
+
style?: React.CSSProperties;
|
|
6
10
|
label?: React.ReactNode;
|
|
7
11
|
span?: number | "filled" | {
|
|
8
|
-
xs?: number;
|
|
9
|
-
sm?: number;
|
|
10
|
-
md?: number;
|
|
11
|
-
lg?: number;
|
|
12
|
-
xl?: number;
|
|
13
12
|
xxl?: number;
|
|
13
|
+
xl?: number;
|
|
14
|
+
lg?: number;
|
|
15
|
+
md?: number;
|
|
16
|
+
sm?: number;
|
|
17
|
+
xs?: number;
|
|
14
18
|
};
|
|
15
|
-
style?: React.CSSProperties;
|
|
16
|
-
classNames?: Partial<Record<"label" | "content", string>>;
|
|
17
|
-
styles?: Partial<Record<"label" | "content", React.CSSProperties>>;
|
|
18
|
-
className?: string;
|
|
19
19
|
labelStyle?: React.CSSProperties;
|
|
20
20
|
contentStyle?: React.CSSProperties;
|
|
21
21
|
}[];
|
|
@@ -9,6 +9,16 @@ export interface DescriptionsItemType extends AntDescriptionsItemType {
|
|
|
9
9
|
}
|
|
10
10
|
export interface DescriptionsProps extends AntDescriptionsProps {
|
|
11
11
|
items?: DescriptionsItemType[];
|
|
12
|
+
/** Whether the descriptions is collapsible */
|
|
13
|
+
collapsible?: boolean;
|
|
14
|
+
/** Whether the descriptions is collapsed (controlled mode) */
|
|
15
|
+
collapsed?: boolean;
|
|
16
|
+
/** Default collapsed state (uncontrolled mode) */
|
|
17
|
+
defaultCollapsed?: boolean;
|
|
18
|
+
/** Callback when collapsed state changes */
|
|
19
|
+
onCollapse?: (collapsed: boolean) => void;
|
|
20
|
+
/** Content alignment, when set to 'left', all content values will be aligned to the left based on the longest label width */
|
|
21
|
+
contentAlign?: 'left';
|
|
12
22
|
}
|
|
13
23
|
type CompoundedComponent = React.FC<DescriptionsProps> & {
|
|
14
24
|
Item: typeof DescriptionsItem;
|
|
@@ -36,7 +36,9 @@ module.exports = __toCommonJS(descriptions_exports);
|
|
|
36
36
|
var import_antd = require("antd");
|
|
37
37
|
var import_classnames = __toESM(require("classnames"));
|
|
38
38
|
var import_react = require("react");
|
|
39
|
+
var import_icons = require("@oceanbase/icons");
|
|
39
40
|
var import_config_provider = __toESM(require("../config-provider"));
|
|
41
|
+
var import_theme = __toESM(require("../theme"));
|
|
40
42
|
var import_Item = __toESM(require("./Item"));
|
|
41
43
|
var import_useItems = __toESM(require("./hooks/useItems"));
|
|
42
44
|
var import_style = __toESM(require("./style"));
|
|
@@ -48,19 +50,62 @@ var Descriptions = ({
|
|
|
48
50
|
layout = "horizontal",
|
|
49
51
|
colon = layout === "vertical" ? false : void 0,
|
|
50
52
|
items,
|
|
53
|
+
title,
|
|
51
54
|
prefixCls: customizePrefixCls,
|
|
52
55
|
className,
|
|
56
|
+
column = 3,
|
|
57
|
+
collapsible,
|
|
58
|
+
collapsed: outerCollapsed,
|
|
59
|
+
defaultCollapsed,
|
|
60
|
+
onCollapse,
|
|
61
|
+
contentAlign,
|
|
53
62
|
...restProps
|
|
54
63
|
}) => {
|
|
55
64
|
const { getPrefixCls } = (0, import_react.useContext)(import_config_provider.default.ConfigContext);
|
|
65
|
+
const { token } = import_theme.default.useToken();
|
|
56
66
|
const prefixCls = getPrefixCls("descriptions", customizePrefixCls);
|
|
57
67
|
const typographyPrefixCls = getPrefixCls("typography", customizePrefixCls);
|
|
58
68
|
const { wrapSSR } = (0, import_style.default)(prefixCls, typographyPrefixCls);
|
|
69
|
+
const [internalCollapsed, setInternalCollapsed] = (0, import_react.useState)(defaultCollapsed ?? false);
|
|
70
|
+
const collapsed = outerCollapsed !== void 0 ? outerCollapsed : internalCollapsed;
|
|
71
|
+
const handleCollapse = (0, import_react.useCallback)(() => {
|
|
72
|
+
const newCollapsed = !collapsed;
|
|
73
|
+
if (outerCollapsed === void 0) {
|
|
74
|
+
setInternalCollapsed(newCollapsed);
|
|
75
|
+
}
|
|
76
|
+
onCollapse == null ? void 0 : onCollapse(newCollapsed);
|
|
77
|
+
}, [collapsed, outerCollapsed, onCollapse]);
|
|
78
|
+
const newItems = (0, import_useItems.default)(items, children, bordered);
|
|
79
|
+
const descriptionsTitle = (0, import_react.useMemo)(() => {
|
|
80
|
+
if (!collapsible) {
|
|
81
|
+
return title;
|
|
82
|
+
}
|
|
83
|
+
if (!title) {
|
|
84
|
+
return null;
|
|
85
|
+
}
|
|
86
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: `${prefixCls}-title-wrapper`, onClick: handleCollapse, children: [
|
|
87
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
88
|
+
import_icons.CaretRightFilled,
|
|
89
|
+
{
|
|
90
|
+
className: `${prefixCls}-collapsible-icon`,
|
|
91
|
+
style: {
|
|
92
|
+
transition: `transform ${token.motionDurationMid}`,
|
|
93
|
+
transform: collapsed ? void 0 : "rotate(90deg)",
|
|
94
|
+
color: token.colorIcon,
|
|
95
|
+
marginRight: token.marginXS
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
),
|
|
99
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: title })
|
|
100
|
+
] });
|
|
101
|
+
}, [collapsible, title, collapsed, prefixCls, token, handleCollapse]);
|
|
59
102
|
const descriptionsCls = (0, import_classnames.default)(className, {
|
|
60
103
|
[`${prefixCls}-vertical`]: layout === "vertical",
|
|
61
|
-
[`${prefixCls}-horizontal`]: layout === "horizontal"
|
|
104
|
+
[`${prefixCls}-horizontal`]: layout === "horizontal",
|
|
105
|
+
[`${prefixCls}-collapsible`]: collapsible,
|
|
106
|
+
[`${prefixCls}-collapsed`]: collapsible && collapsed,
|
|
107
|
+
[`${prefixCls}-content-align-left`]: contentAlign === "left"
|
|
62
108
|
});
|
|
63
|
-
const newItems = (0, import_useItems.default)(items, children, bordered);
|
|
64
109
|
return wrapSSR(
|
|
65
110
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
66
111
|
import_antd.Descriptions,
|
|
@@ -68,7 +113,9 @@ var Descriptions = ({
|
|
|
68
113
|
layout,
|
|
69
114
|
colon,
|
|
70
115
|
bordered,
|
|
116
|
+
column,
|
|
71
117
|
items: newItems,
|
|
118
|
+
title: descriptionsTitle,
|
|
72
119
|
prefixCls: customizePrefixCls,
|
|
73
120
|
className: descriptionsCls,
|
|
74
121
|
...restProps
|
|
@@ -67,13 +67,31 @@ var genDescriptionsStyle = (token) => {
|
|
|
67
67
|
const { componentCls, typographyComponentCls, calc } = token;
|
|
68
68
|
return {
|
|
69
69
|
[`${componentCls}`]: {
|
|
70
|
+
[`${componentCls}-header`]: {
|
|
71
|
+
marginBottom: token.margin
|
|
72
|
+
},
|
|
73
|
+
// collapsible title style
|
|
74
|
+
[`${componentCls}-title-wrapper`]: {
|
|
75
|
+
cursor: "pointer",
|
|
76
|
+
display: "flex",
|
|
77
|
+
alignItems: "center",
|
|
78
|
+
userSelect: "none",
|
|
79
|
+
[`${componentCls}-collapsible-icon`]: {
|
|
80
|
+
fontSize: token.fontSizeLG
|
|
81
|
+
}
|
|
82
|
+
},
|
|
70
83
|
...genVerticalStyle("default", token),
|
|
84
|
+
[`${componentCls}-row > th, ${componentCls}-row > td`]: {
|
|
85
|
+
paddingRight: token.paddingLG
|
|
86
|
+
},
|
|
71
87
|
[`${componentCls}-item-label`]: {
|
|
72
|
-
fontWeight: token.fontWeightWeak
|
|
88
|
+
fontWeight: token.fontWeightWeak,
|
|
89
|
+
[`&${componentCls}-item-no-colon::after`]: {
|
|
90
|
+
display: "none"
|
|
91
|
+
}
|
|
73
92
|
},
|
|
74
93
|
[`${componentCls}-item-container`]: {
|
|
75
94
|
[`${componentCls}-item-content`]: {
|
|
76
|
-
paddingRight: 12,
|
|
77
95
|
[`${typographyComponentCls}-edit-content`]: {
|
|
78
96
|
insetInlineStart: 0,
|
|
79
97
|
marginTop: 0,
|
|
@@ -86,8 +104,71 @@ var genDescriptionsStyle = (token) => {
|
|
|
86
104
|
height: calc(token.fontSize).mul(token.lineHeight).equal()
|
|
87
105
|
}
|
|
88
106
|
},
|
|
89
|
-
[`${componentCls}${componentCls}-middle`]:
|
|
90
|
-
|
|
107
|
+
[`${componentCls}${componentCls}-middle`]: {
|
|
108
|
+
[`${componentCls}-header`]: {
|
|
109
|
+
marginBottom: token.marginSM
|
|
110
|
+
},
|
|
111
|
+
...genVerticalStyle("middle", token)
|
|
112
|
+
},
|
|
113
|
+
[`${componentCls}${componentCls}-small`]: {
|
|
114
|
+
[`${componentCls}-header`]: {
|
|
115
|
+
marginBottom: token.marginXS
|
|
116
|
+
},
|
|
117
|
+
...genVerticalStyle("small", token)
|
|
118
|
+
},
|
|
119
|
+
// collapsed state
|
|
120
|
+
[`${componentCls}${componentCls}-collapsed`]: {
|
|
121
|
+
[`${componentCls}-view`]: {
|
|
122
|
+
display: "none"
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
// contentAlign="left": label column auto width based on longest label
|
|
126
|
+
// For non-bordered mode: use CSS Grid to make label and content align across rows
|
|
127
|
+
[`${componentCls}${componentCls}-content-align-left:not(${componentCls}-bordered)`]: {
|
|
128
|
+
[`${componentCls}-view`]: {
|
|
129
|
+
display: "block"
|
|
130
|
+
},
|
|
131
|
+
// Make table, tbody, tr, td all transparent to grid layout
|
|
132
|
+
[`${componentCls}-view > table`]: {
|
|
133
|
+
display: "grid",
|
|
134
|
+
gridTemplateColumns: "auto 1fr"
|
|
135
|
+
},
|
|
136
|
+
[`${componentCls}-view > table > tbody`]: {
|
|
137
|
+
display: "contents"
|
|
138
|
+
},
|
|
139
|
+
[`${componentCls}-row`]: {
|
|
140
|
+
display: "contents"
|
|
141
|
+
},
|
|
142
|
+
[`${componentCls}-row > td${componentCls}-item`]: {
|
|
143
|
+
display: "contents"
|
|
144
|
+
},
|
|
145
|
+
[`${componentCls}-item-container`]: {
|
|
146
|
+
display: "contents"
|
|
147
|
+
},
|
|
148
|
+
[`${componentCls}-item-label`]: {
|
|
149
|
+
whiteSpace: "nowrap",
|
|
150
|
+
paddingBottom: token.padding,
|
|
151
|
+
paddingInlineEnd: token.paddingLG
|
|
152
|
+
},
|
|
153
|
+
[`${componentCls}-item-content`]: {
|
|
154
|
+
paddingBottom: token.padding
|
|
155
|
+
}
|
|
156
|
+
},
|
|
157
|
+
// For bordered mode: label and content are in separate th and td
|
|
158
|
+
[`${componentCls}${componentCls}-content-align-left${componentCls}-bordered`]: {
|
|
159
|
+
[`${componentCls}-view > table`]: {
|
|
160
|
+
tableLayout: "auto"
|
|
161
|
+
},
|
|
162
|
+
[`${componentCls}-row`]: {
|
|
163
|
+
[`& > th`]: {
|
|
164
|
+
whiteSpace: "nowrap",
|
|
165
|
+
width: 1
|
|
166
|
+
},
|
|
167
|
+
[`& > td`]: {
|
|
168
|
+
width: "100%"
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
91
172
|
};
|
|
92
173
|
};
|
|
93
174
|
var style_default = (prefixCls, typographyPrefixCls) => {
|
|
@@ -26,14 +26,16 @@ module.exports = __toCommonJS(style_exports);
|
|
|
26
26
|
var import_cssinjs = require("@ant-design/cssinjs");
|
|
27
27
|
var import_genComponentStyleHook = require("../../_util/genComponentStyleHook");
|
|
28
28
|
var genDrawerStyle = (token) => {
|
|
29
|
-
const { componentCls, antCls, fontSizeHeading3, colorSplit, calc } = token;
|
|
29
|
+
const { componentCls, antCls, iconCls, fontSizeHeading3, colorSplit, calc } = token;
|
|
30
30
|
const contentPadding = token.paddingLG;
|
|
31
|
-
const
|
|
32
|
-
const
|
|
31
|
+
const boxShadowTop = "0 -1px 2px 0 rgba(19, 33, 57, 0.1)";
|
|
32
|
+
const boxShadowBottom = "0 1px 2px 0 rgba(19, 33, 57, 0.1)";
|
|
33
33
|
return {
|
|
34
34
|
[`${componentCls}`]: {
|
|
35
35
|
// should be wrapped by `${componentCls}-content` to overwritten antd style
|
|
36
36
|
[`${componentCls}-content`]: {
|
|
37
|
+
// to avoid x scroll
|
|
38
|
+
overflow: "initial",
|
|
37
39
|
[`${componentCls}-header`]: {
|
|
38
40
|
position: "relative",
|
|
39
41
|
padding: `${(0, import_cssinjs.unit)(token.padding)} ${(0, import_cssinjs.unit)(token.paddingLG)}`,
|
|
@@ -42,7 +44,10 @@ var genDrawerStyle = (token) => {
|
|
|
42
44
|
// ensure header box-shadow cover body content
|
|
43
45
|
zIndex: 10,
|
|
44
46
|
[`${componentCls}-title`]: {
|
|
45
|
-
fontSize: fontSizeHeading3
|
|
47
|
+
fontSize: fontSizeHeading3,
|
|
48
|
+
[iconCls]: {
|
|
49
|
+
fontSize: token.fontSizeLG
|
|
50
|
+
}
|
|
46
51
|
},
|
|
47
52
|
// 标题栏底部增加分割线
|
|
48
53
|
"&::after": {
|
|
@@ -23,11 +23,14 @@ __export(style_exports, {
|
|
|
23
23
|
genSliderStyle: () => genSliderStyle
|
|
24
24
|
});
|
|
25
25
|
module.exports = __toCommonJS(style_exports);
|
|
26
|
+
var import_cssinjs = require("@ant-design/cssinjs");
|
|
26
27
|
var import_genComponentStyleHook = require("../../_util/genComponentStyleHook");
|
|
27
28
|
var genSliderStyle = (token) => {
|
|
28
29
|
const { componentCls, dotSize = 8, handleSize = 10, handleLineWidth = 2, calc } = token;
|
|
29
|
-
const dotSizeHalf = calc(dotSize).div(2).equal();
|
|
30
|
-
const handleOffset =
|
|
30
|
+
const dotSizeHalf = (0, import_cssinjs.unit)(calc(dotSize).div(2).equal());
|
|
31
|
+
const handleOffset = (0, import_cssinjs.unit)(
|
|
32
|
+
calc(handleSize).add(calc(handleLineWidth).mul(2).equal()).div(2).equal()
|
|
33
|
+
);
|
|
31
34
|
return {
|
|
32
35
|
[`${componentCls}${componentCls}-horizontal`]: {
|
|
33
36
|
[`${componentCls}-mark`]: {
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OceanBase Design System - CSS Variables Style
|
|
3
|
+
* 使用 @ant-design/cssinjs 动态注入 CSS 变量
|
|
4
|
+
* 根据主题 token 值动态生成
|
|
5
|
+
*/
|
|
6
|
+
import React from 'react';
|
|
7
|
+
import type { CSSInterpolation } from '@ant-design/cssinjs';
|
|
8
|
+
import type { GlobalToken } from '../theme/interface';
|
|
9
|
+
/**
|
|
10
|
+
* 根据 token 生成 CSS 变量样式
|
|
11
|
+
*/
|
|
12
|
+
declare const genCssVariablesStyle: (token: GlobalToken, prefix?: string) => CSSInterpolation;
|
|
13
|
+
export interface CssVariablesStyleProps {
|
|
14
|
+
/**
|
|
15
|
+
* CSS 变量前缀,默认为 'ob'
|
|
16
|
+
*/
|
|
17
|
+
prefix?: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* CSS 变量注入组件
|
|
21
|
+
* 使用 @ant-design/cssinjs 动态注入 CSS 变量
|
|
22
|
+
*/
|
|
23
|
+
declare const CssVariablesStyle: React.FC<CssVariablesStyleProps>;
|
|
24
|
+
export { CssVariablesStyle, genCssVariablesStyle };
|
|
25
|
+
export default CssVariablesStyle;
|