Skip to content

Commit

Permalink
Merge pull request #47304 from ant-design/master-merge-feature
Browse files Browse the repository at this point in the history
Master merge feature
  • Loading branch information
li-jia-nan committed Feb 2, 2024
2 parents 82b1f77 + 03b9175 commit 0c781ee
Show file tree
Hide file tree
Showing 134 changed files with 246,558 additions and 211,032 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,4 @@ __image_snapshots__/

.eslintcache
.node-version
.node
10 changes: 8 additions & 2 deletions components/affix/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ export function getTargetRect(target: BindElement): DOMRect {
}

export function getFixedTop(placeholderRect: DOMRect, targetRect: DOMRect, offsetTop?: number) {
if (offsetTop !== undefined && Math.round(targetRect.top) > Math.round(placeholderRect.top) - offsetTop) {
if (
offsetTop !== undefined &&
Math.round(targetRect.top) > Math.round(placeholderRect.top) - offsetTop
) {
return offsetTop + targetRect.top;
}
return undefined;
Expand All @@ -18,7 +21,10 @@ export function getFixedBottom(
targetRect: DOMRect,
offsetBottom?: number,
) {
if (offsetBottom !== undefined && Math.round(targetRect.bottom) < Math.round(placeholderRect.bottom) + offsetBottom) {
if (
offsetBottom !== undefined &&
Math.round(targetRect.bottom) < Math.round(placeholderRect.bottom) + offsetBottom
) {
const targetBottomOffset = window.innerHeight - targetRect.bottom;
return offsetBottom + targetBottomOffset;
}
Expand Down
8 changes: 4 additions & 4 deletions components/alert/Alert.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ interface CloseIconProps {
handleClose: AlertProps['onClose'];
}

const CloseIcon: React.FC<CloseIconProps> = (props) => {
const CloseIconNode: React.FC<CloseIconProps> = (props) => {
const { isClosable, prefixCls, closeIcon, handleClose } = props;
const mergedCloseIcon =
closeIcon === true || closeIcon === undefined ? <CloseOutlined /> : closeIcon;
Expand Down Expand Up @@ -143,7 +143,7 @@ const Alert: React.FC<AlertProps> = (props) => {
}, [props.type, banner]);

// closeable when closeText or closeIcon is assigned
const isClosable = React.useMemo(() => {
const isClosable = React.useMemo<boolean>(() => {
if (closeText) {
return true;
}
Expand Down Expand Up @@ -209,10 +209,10 @@ const Alert: React.FC<AlertProps> = (props) => {
{description ? <div className={`${prefixCls}-description`}>{description}</div> : null}
</div>
{action ? <div className={`${prefixCls}-action`}>{action}</div> : null}
<CloseIcon
<CloseIconNode
isClosable={isClosable}
prefixCls={prefixCls}
closeIcon={closeText || closeIcon}
closeIcon={closeText || (closeIcon ?? alert?.closeIcon)}
handleClose={handleClose}
/>
</div>
Expand Down
10 changes: 6 additions & 4 deletions components/button/style/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,12 +179,14 @@ const genDefaultButtonStyle: GenerateStyle<ButtonToken, CSSObject> = (token) =>
...genHoverActiveButtonStyle(
token.componentCls,
{
color: token.colorPrimaryHover,
borderColor: token.colorPrimaryHover,
color: token.defaultHoverColor,
borderColor: token.defaultHoverBorderColor,
background: token.defaultHoverBg,
},
{
color: token.colorPrimaryActive,
borderColor: token.colorPrimaryActive,
color: token.defaultActiveColor,
borderColor: token.defaultActiveBorderColor,
background: token.defaultActiveBg,
},
),

Expand Down
36 changes: 36 additions & 0 deletions components/button/style/token.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,36 @@ export interface ComponentToken {
* @descEN Text color of danger button
*/
dangerColor: string;
/**
* @desc 默认按钮悬浮态背景色
* @descEN Background color of default button when hover
*/
defaultHoverBg: string;
/**
* @desc 默认按钮悬浮态文本颜色
* @descEN Text color of default button when hover
*/
defaultHoverColor: string;
/**
* @desc 默认按钮悬浮态边框颜色
* @descEN Border color of default button
*/
defaultHoverBorderColor: string;
/**
* @desc 默认按钮激活态背景色
* @descEN Background color of default button when active
*/
defaultActiveBg: string;
/**
* @desc 默认按钮激活态文字颜色
* @descEN Text color of default button when active
*/
defaultActiveColor: string;
/**
* @desc 默认按钮激活态边框颜色
* @descEN Border color of default button when active
*/
defaultActiveBorderColor: string;
/**
* @desc 禁用状态边框颜色
* @descEN Border color of disabled button
Expand Down Expand Up @@ -214,6 +244,12 @@ export const prepareComponentToken: GetDefaultToken<'Button'> = (token) => {
defaultBg: token.colorBgContainer,
defaultBorderColor: token.colorBorder,
defaultBorderColorDisabled: token.colorBorder,
defaultHoverBg: token.colorBgContainer,
defaultHoverColor: token.colorPrimaryHover,
defaultHoverBorderColor: token.colorPrimaryHover,
defaultActiveBg: token.colorBgContainer,
defaultActiveColor: token.colorPrimaryActive,
defaultActiveBorderColor: token.colorPrimaryActive,
contentFontSize,
contentFontSizeSM,
contentFontSizeLG,
Expand Down
Loading

0 comments on commit 0c781ee

Please sign in to comment.