2023-11-14 09:43:45 +08:00
|
|
|
import type { FullToken, GenerateStyle, GetDefaultToken } from '../../theme/internal';
|
2022-11-23 20:22:38 +08:00
|
|
|
import { genComponentStyleHook } from '../../theme/internal';
|
2017-02-22 18:10:02 +08:00
|
|
|
|
2022-05-23 20:34:20 +08:00
|
|
|
export interface ComponentToken {
|
2023-07-05 17:49:59 +08:00
|
|
|
/**
|
|
|
|
* @desc 确认框 z-index
|
|
|
|
* @descEN z-index of Popconfirm
|
|
|
|
*/
|
2022-05-23 20:34:20 +08:00
|
|
|
zIndexPopup: number;
|
|
|
|
}
|
2020-07-20 13:39:28 +08:00
|
|
|
|
2022-05-23 20:34:20 +08:00
|
|
|
export interface PopconfirmToken extends FullToken<'Popconfirm'> {}
|
|
|
|
|
|
|
|
// =============================== Base ===============================
|
2022-11-19 13:47:33 +08:00
|
|
|
const genBaseStyle: GenerateStyle<PopconfirmToken> = (token) => {
|
2022-05-23 20:34:20 +08:00
|
|
|
const {
|
|
|
|
componentCls,
|
|
|
|
iconCls,
|
2023-06-27 20:03:43 +08:00
|
|
|
antCls,
|
2022-05-23 20:34:20 +08:00
|
|
|
zIndexPopup,
|
|
|
|
colorText,
|
|
|
|
colorWarning,
|
2023-05-17 14:49:42 +08:00
|
|
|
marginXXS,
|
2022-05-23 20:34:20 +08:00
|
|
|
marginXS,
|
|
|
|
fontSize,
|
2022-12-08 16:39:42 +08:00
|
|
|
fontWeightStrong,
|
2023-06-06 10:53:28 +08:00
|
|
|
colorTextHeading,
|
2022-05-23 20:34:20 +08:00
|
|
|
} = token;
|
|
|
|
|
|
|
|
return {
|
|
|
|
[componentCls]: {
|
|
|
|
zIndex: zIndexPopup,
|
2023-06-27 20:03:43 +08:00
|
|
|
|
|
|
|
[`&${antCls}-popover`]: {
|
|
|
|
fontSize,
|
|
|
|
},
|
2022-05-23 20:34:20 +08:00
|
|
|
|
|
|
|
[`${componentCls}-message`]: {
|
2022-09-06 10:13:18 +08:00
|
|
|
marginBottom: marginXS,
|
2022-05-23 20:34:20 +08:00
|
|
|
display: 'flex',
|
|
|
|
flexWrap: 'nowrap',
|
|
|
|
alignItems: 'start',
|
|
|
|
|
2022-10-21 10:16:03 +08:00
|
|
|
[`> ${componentCls}-message-icon ${iconCls}`]: {
|
2022-05-23 20:34:20 +08:00
|
|
|
color: colorWarning,
|
|
|
|
fontSize,
|
|
|
|
lineHeight: 1,
|
2023-05-17 14:49:42 +08:00
|
|
|
marginInlineEnd: marginXS,
|
2022-05-23 20:34:20 +08:00
|
|
|
},
|
2022-12-08 16:39:42 +08:00
|
|
|
|
2023-05-17 14:49:42 +08:00
|
|
|
[`${componentCls}-title`]: {
|
2022-12-08 16:39:42 +08:00
|
|
|
fontWeight: fontWeightStrong,
|
2023-06-06 10:53:28 +08:00
|
|
|
color: colorTextHeading,
|
2023-05-17 14:49:42 +08:00
|
|
|
|
|
|
|
'&:only-child': {
|
|
|
|
fontWeight: 'normal',
|
|
|
|
},
|
2022-12-08 16:39:42 +08:00
|
|
|
},
|
|
|
|
|
2023-05-17 14:49:42 +08:00
|
|
|
[`${componentCls}-description`]: {
|
|
|
|
marginTop: marginXXS,
|
2023-06-27 20:03:43 +08:00
|
|
|
color: colorText,
|
2023-05-17 14:49:42 +08:00
|
|
|
},
|
2022-05-23 20:34:20 +08:00
|
|
|
},
|
|
|
|
|
|
|
|
[`${componentCls}-buttons`]: {
|
|
|
|
textAlign: 'end',
|
2023-08-04 18:08:27 +08:00
|
|
|
whiteSpace: 'nowrap',
|
2022-05-23 20:34:20 +08:00
|
|
|
|
|
|
|
button: {
|
|
|
|
marginInlineStart: marginXS,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
// ============================== Export ==============================
|
2023-11-14 09:43:45 +08:00
|
|
|
export const prepareComponentToken: GetDefaultToken<'Popconfirm'> = (token) => {
|
|
|
|
const { zIndexPopupBase } = token;
|
|
|
|
|
|
|
|
return {
|
|
|
|
zIndexPopup: zIndexPopupBase + 60,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2022-05-23 20:34:20 +08:00
|
|
|
export default genComponentStyleHook(
|
|
|
|
'Popconfirm',
|
2022-11-19 13:47:33 +08:00
|
|
|
(token) => genBaseStyle(token),
|
2023-11-14 09:43:45 +08:00
|
|
|
prepareComponentToken,
|
2023-09-07 09:29:38 +08:00
|
|
|
{
|
|
|
|
resetStyle: false,
|
|
|
|
},
|
2022-05-23 20:34:20 +08:00
|
|
|
);
|