mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-11-29 18:50:00 +08:00
type: rm useless type (#46920)
* type: rm useless type" * update size-limit
This commit is contained in:
parent
213723a2e8
commit
1b2362a425
@ -1,12 +1,8 @@
|
||||
import CloseOutlined from '@ant-design/icons/CloseOutlined';
|
||||
import type { ReactNode } from 'react';
|
||||
import React from 'react';
|
||||
import CloseOutlined from '@ant-design/icons/CloseOutlined';
|
||||
|
||||
function useInnerClosable(
|
||||
closable?: boolean,
|
||||
closeIcon?: boolean | ReactNode,
|
||||
defaultClosable?: boolean,
|
||||
): boolean {
|
||||
function useInnerClosable(closable?: boolean, closeIcon?: ReactNode, defaultClosable?: boolean) {
|
||||
if (typeof closable === 'boolean') {
|
||||
return closable;
|
||||
}
|
||||
@ -18,15 +14,15 @@ function useInnerClosable(
|
||||
|
||||
export type UseClosableParams = {
|
||||
closable?: boolean;
|
||||
closeIcon?: boolean | ReactNode;
|
||||
closeIcon?: ReactNode;
|
||||
defaultClosable?: boolean;
|
||||
defaultCloseIcon?: ReactNode;
|
||||
customCloseIconRender?: (closeIcon: ReactNode) => ReactNode;
|
||||
};
|
||||
|
||||
export default function useClosable(
|
||||
function useClosable(
|
||||
closable?: boolean,
|
||||
closeIcon?: boolean | ReactNode,
|
||||
closeIcon?: ReactNode,
|
||||
customCloseIconRender?: (closeIcon: ReactNode) => ReactNode,
|
||||
defaultCloseIcon: ReactNode = <CloseOutlined />,
|
||||
defaultClosable = false,
|
||||
@ -41,3 +37,5 @@ export default function useClosable(
|
||||
: closeIcon;
|
||||
return [true, customCloseIconRender ? customCloseIconRender(mergedCloseIcon) : mergedCloseIcon];
|
||||
}
|
||||
|
||||
export default useClosable;
|
||||
|
@ -43,7 +43,7 @@ export interface AlertProps {
|
||||
banner?: boolean;
|
||||
icon?: React.ReactNode;
|
||||
/** Custom closeIcon */
|
||||
closeIcon?: boolean | React.ReactNode;
|
||||
closeIcon?: React.ReactNode;
|
||||
action?: React.ReactNode;
|
||||
onMouseEnter?: React.MouseEventHandler<HTMLDivElement>;
|
||||
onMouseLeave?: React.MouseEventHandler<HTMLDivElement>;
|
||||
|
@ -31,7 +31,7 @@ export interface DrawerPanelProps {
|
||||
* `<Drawer closeIcon={false} />`
|
||||
*/
|
||||
closable?: boolean;
|
||||
closeIcon?: boolean | React.ReactNode;
|
||||
closeIcon?: React.ReactNode;
|
||||
onClose?: RCDrawerProps['onClose'];
|
||||
|
||||
children?: React.ReactNode;
|
||||
|
@ -179,7 +179,7 @@ describe('Form', () => {
|
||||
|
||||
// https://github.com/ant-design/ant-design/issues/41620
|
||||
it('should not throw error when `help=false` and `noStyle=true`', async () => {
|
||||
const App = (props: { help?: boolean | React.ReactNode }) => {
|
||||
const App: React.FC<{ help?: React.ReactNode }> = (props) => {
|
||||
const { help = false } = props || {};
|
||||
return (
|
||||
<Form>
|
||||
|
@ -1,8 +1,8 @@
|
||||
import type { FC } from 'react';
|
||||
import type { DialogProps } from 'rc-dialog';
|
||||
|
||||
import type { ButtonProps, LegacyButtonType } from '../button/button';
|
||||
import type { DirectionType } from '../config-provider';
|
||||
import type { DialogProps } from 'rc-dialog';
|
||||
|
||||
export type ModalFooterRender = (
|
||||
originNode: React.ReactNode,
|
||||
@ -63,7 +63,7 @@ export interface ModalProps extends ModalCommonProps {
|
||||
keyboard?: boolean;
|
||||
wrapProps?: any;
|
||||
prefixCls?: string;
|
||||
closeIcon?: boolean | React.ReactNode;
|
||||
closeIcon?: React.ReactNode;
|
||||
modalRender?: (node: React.ReactNode) => React.ReactNode;
|
||||
focusTriggerAfterClose?: boolean;
|
||||
children?: React.ReactNode;
|
||||
|
@ -12,7 +12,7 @@ export const NotificationPlacements = [
|
||||
'bottomLeft',
|
||||
'bottomRight',
|
||||
] as const;
|
||||
export type NotificationPlacement = typeof NotificationPlacements[number];
|
||||
export type NotificationPlacement = (typeof NotificationPlacements)[number];
|
||||
|
||||
export type IconType = 'success' | 'info' | 'error' | 'warning';
|
||||
|
||||
@ -29,7 +29,7 @@ export interface ArgsProps {
|
||||
className?: string;
|
||||
readonly type?: IconType;
|
||||
onClick?: () => void;
|
||||
closeIcon?: boolean | React.ReactNode;
|
||||
closeIcon?: React.ReactNode;
|
||||
props?: DivProps;
|
||||
role?: 'alert' | 'status';
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ export interface TagProps extends React.HTMLAttributes<HTMLSpanElement> {
|
||||
color?: LiteralUnion<PresetColorType | PresetStatusColorType>;
|
||||
closable?: boolean;
|
||||
/** Advised to use closeIcon instead. */
|
||||
closeIcon?: boolean | React.ReactNode;
|
||||
closeIcon?: React.ReactNode;
|
||||
/** @deprecated `visible` will be removed in next major version. */
|
||||
visible?: boolean;
|
||||
onClose?: (e: React.MouseEvent<HTMLElement>) => void;
|
||||
|
@ -71,7 +71,7 @@ const treeData: DataNode[] = [
|
||||
const App: React.FC = () => {
|
||||
const [showLine, setShowLine] = useState<boolean>(true);
|
||||
const [showIcon, setShowIcon] = useState<boolean>(false);
|
||||
const [showLeafIcon, setShowLeafIcon] = useState<boolean | React.ReactNode>(true);
|
||||
const [showLeafIcon, setShowLeafIcon] = useState<React.ReactNode>(true);
|
||||
|
||||
const onSelect = (selectedKeys: React.Key[], info: any) => {
|
||||
console.log('selected', selectedKeys, info);
|
||||
|
@ -32,7 +32,7 @@ interface CopyConfig {
|
||||
text?: string;
|
||||
onCopy?: (event?: React.MouseEvent<HTMLDivElement>) => void;
|
||||
icon?: React.ReactNode;
|
||||
tooltips?: boolean | React.ReactNode;
|
||||
tooltips?: React.ReactNode;
|
||||
format?: 'text/plain' | 'text/html';
|
||||
}
|
||||
|
||||
@ -40,7 +40,7 @@ interface EditConfig {
|
||||
text?: string;
|
||||
editing?: boolean;
|
||||
icon?: React.ReactNode;
|
||||
tooltip?: boolean | React.ReactNode;
|
||||
tooltip?: React.ReactNode;
|
||||
onStart?: () => void;
|
||||
onChange?: (value: string) => void;
|
||||
onCancel?: () => void;
|
||||
|
@ -1,8 +1,8 @@
|
||||
import React from 'react';
|
||||
import { LikeOutlined, SmileOutlined } from '@ant-design/icons';
|
||||
import * as copyObj from 'copy-to-clipboard';
|
||||
import React from 'react';
|
||||
import { fireEvent, render, waitFakeTimer, waitFor } from '../../../tests/utils';
|
||||
|
||||
import { fireEvent, render, waitFakeTimer, waitFor } from '../../../tests/utils';
|
||||
import Base from '../Base';
|
||||
|
||||
describe('Typography copy', () => {
|
||||
@ -24,8 +24,8 @@ describe('Typography copy', () => {
|
||||
tooltipLength,
|
||||
}: {
|
||||
name: string;
|
||||
icon?: boolean | React.ReactNode;
|
||||
tooltips?: boolean | React.ReactNode;
|
||||
icon?: React.ReactNode;
|
||||
tooltips?: React.ReactNode;
|
||||
iconClassNames?: string[];
|
||||
iconTexts?: string[];
|
||||
tooltipTexts?: string[];
|
||||
|
@ -349,11 +349,11 @@
|
||||
"size-limit": [
|
||||
{
|
||||
"path": "./dist/antd.min.js",
|
||||
"limit": "333 KiB"
|
||||
"limit": "334 KiB"
|
||||
},
|
||||
{
|
||||
"path": "./dist/antd-with-locales.min.js",
|
||||
"limit": "377 KiB"
|
||||
"limit": "378 KiB"
|
||||
}
|
||||
],
|
||||
"title": "Ant Design",
|
||||
|
Loading…
Reference in New Issue
Block a user