docs: format code (#48309)

* docs: fix code

* feat: lint

* feat: prettier

* feat: test

* feat: review

* feat: format html

* feat: format html
This commit is contained in:
叶枫 2024-04-08 14:04:08 +08:00 committed by GitHub
parent a125dfee8b
commit 502dac12aa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
628 changed files with 1088 additions and 593 deletions

View File

@ -1,5 +1,6 @@
import assert from 'assert';
import { unistUtilVisit, type HastRoot, type UnifiedTransformer } from 'dumi';
import type { HastRoot, UnifiedTransformer } from 'dumi';
import { unistUtilVisit } from 'dumi';
/**
* plugin for modify hast tree when docs compiling

View File

@ -1,5 +1,6 @@
import * as React from 'react';
import { TinyColor, type ColorInput } from '@ctrl/tinycolor';
import type { ColorInput } from '@ctrl/tinycolor';
import { TinyColor } from '@ctrl/tinycolor';
import { createStyles } from 'antd-style';
interface ColorChunkProps {

View File

@ -1,6 +1,7 @@
import React from 'react';
import { EditOutlined, GithubOutlined } from '@ant-design/icons';
import { Descriptions, theme, Tooltip, Typography, type GetProp } from 'antd';
import type { GetProp } from 'antd';
import { Descriptions, theme, Tooltip, Typography } from 'antd';
import { createStyles, css } from 'antd-style';
import kebabCase from 'lodash/kebabCase';
import CopyToClipboard from 'react-copy-to-clipboard';

View File

@ -2,7 +2,7 @@
* copied: https://github.com/arvinxx/dumi-theme-antd-style/tree/master/src/builtins/Container
*/
import * as React from 'react';
import { type FC, type ReactNode } from 'react';
import type { FC, ReactNode } from 'react';
import { Alert } from 'antd';
import useStyles from './style';

View File

@ -1,4 +1,5 @@
import React, { useEffect, useMemo, type ComponentProps } from 'react';
import type { ComponentProps } from 'react';
import React, { useEffect, useMemo } from 'react';
import { Button, Tabs, Typography } from 'antd';
import { createStyles } from 'antd-style';
import toReactElement from 'jsonml-to-react-element';
@ -120,7 +121,7 @@ const CodePreview: React.FC<CodePreviewProps> = ({
style: Prism.highlight(styleCode, Prism.languages.css, 'css'),
};
// 去掉空的代码类型
Object.keys(codes).forEach((key: keyof typeof codes) => {
(Object.keys(codes) as (keyof typeof codes)[]).forEach((key) => {
if (!codes[key]) {
delete codes[key];
}

View File

@ -3,5 +3,5 @@
"compilerOptions": {
"resolveJsonModule": true
},
"include": ["**/*"]
"include": ["**/*", "../typings/index.d.ts"]
}

View File

@ -44,6 +44,7 @@ module.exports = {
'no-unused-expressions': 'off',
'@typescript-eslint/no-unused-expressions': 2,
'@typescript-eslint/consistent-type-imports': [2, { disallowTypeAnnotations: false }],
'import/consistent-type-specifier-style': 2,
},
},
{

View File

@ -31,3 +31,4 @@ components/*/*.jsx
.eslintignore
.history
**/*.yml
*.html

View File

@ -1,4 +1,5 @@
import * as React from 'react';
import { render } from '../../tests/utils';
describe('SetUp.Test', () => {

View File

@ -1,5 +1,6 @@
import useState from 'rc-util/lib/hooks/useState';
import * as React from 'react';
import useState from 'rc-util/lib/hooks/useState';
import Button from '../button';
import type { ButtonProps, LegacyButtonType } from '../button/button';
import { convertLegacyProps } from '../button/buttonHelpers';

View File

@ -1,4 +1,5 @@
import React from 'react';
import { render } from '../../../tests/utils';
import useResponsiveObserver from '../responsiveObserver';

View File

@ -1,6 +1,7 @@
import React from 'react';
import TransButton from '../transButton';
import { render } from '../../../tests/utils';
import TransButton from '../transButton';
describe('transButton component', () => {
it('disabled should update style', () => {

View File

@ -1,6 +1,7 @@
import React from 'react';
import { fireEvent, render } from '../../../tests/utils';
import useSyncState from '../hooks/useSyncState';
import { render, fireEvent } from '../../../tests/utils';
describe('Table', () => {
it('useSyncState', () => {

View File

@ -1,6 +1,7 @@
/* eslint-disable class-methods-use-this */
import KeyCode from 'rc-util/lib/KeyCode';
import React from 'react';
import KeyCode from 'rc-util/lib/KeyCode';
import { fireEvent, render, waitFakeTimer } from '../../../tests/utils';
import { isStyleSupport } from '../styleChecker';
import throttleByAnimationFrame from '../throttleByAnimationFrame';

View File

@ -1,5 +1,6 @@
import { render } from '@testing-library/react';
import React from 'react';
import { render } from '@testing-library/react';
import { devUseWarning as useWarning } from '../warning';
describe('Test warning', () => {

View File

@ -1,10 +1,11 @@
import React from 'react';
import classNames from 'classnames';
import mountTest from '../../../tests/shared/mountTest';
import { act, fireEvent, getByText, render, waitFakeTimer } from '../../../tests/utils';
import Checkbox from '../../checkbox';
import Wave from '../wave';
import { TARGET_CLS } from '../wave/interface';
import Checkbox from '../../checkbox';
(global as any).isVisible = true;

View File

@ -14,7 +14,7 @@ export const PresetStatusColorTypes = [
export type PresetColorType = PresetColorKey | InverseColor;
export type PresetStatusColorType = typeof PresetStatusColorTypes[number];
export type PresetStatusColorType = (typeof PresetStatusColorTypes)[number];
/**
* determine if the color keyword belongs to the `Ant Design` {@link PresetColors}.

View File

@ -1,7 +1,8 @@
// Proxy the dom ref with `{ nativeElement, otherFn }` type
// ref: https://github.com/ant-design/ant-design/discussions/45242
import { useImperativeHandle, type Ref } from 'react';
import { useImperativeHandle } from 'react';
import type { Ref } from 'react';
function fillProxy(
element: HTMLElement & { _antProxy?: Record<string, any> },

View File

@ -27,7 +27,7 @@ const initCollapseMotion = (rootCls: string = 'ant'): CSSMotionProps => ({
const SelectPlacements = ['bottomLeft', 'bottomRight', 'topLeft', 'topRight'] as const;
export type SelectCommonPlacement = typeof SelectPlacements[number];
export type SelectCommonPlacement = (typeof SelectPlacements)[number];
const getTransitionName = (rootPrefixCls: string, motion: string, transitionName?: string) => {
if (transitionName !== undefined) {

View File

@ -1,4 +1,5 @@
import raf from 'rc-util/lib/raf';
import { easeInOutCubic } from './easings';
import getScroll, { isWindow } from './getScroll';

View File

@ -1,9 +1,10 @@
import classNames from 'classnames';
import type { ValidateStatus } from '../form/FormItem';
const InputStatuses = ['warning', 'error', ''] as const;
export type InputStatus = typeof InputStatuses[number];
export type InputStatus = (typeof InputStatuses)[number];
export function getStatusClassNames(
prefixCls: string,

View File

@ -3,8 +3,8 @@
*
* This helps accessibility reader to tread as a interactive button to operation.
*/
import KeyCode from 'rc-util/lib/KeyCode';
import * as React from 'react';
import KeyCode from 'rc-util/lib/KeyCode';
interface TransButtonProps extends React.HTMLAttributes<HTMLDivElement> {
onClick?: (e?: React.MouseEvent<HTMLDivElement>) => void;

View File

@ -4,7 +4,8 @@ import CSSMotion from 'rc-motion';
import raf from 'rc-util/lib/raf';
import { render, unmount } from 'rc-util/lib/React/render';
import { TARGET_CLS, type ShowWaveEffect } from './interface';
import { TARGET_CLS } from './interface';
import type { ShowWaveEffect } from './interface';
import { getTargetWaveColor } from './util';
function validateNum(value: number) {

View File

@ -4,7 +4,8 @@ import raf from 'rc-util/lib/raf';
import { ConfigContext } from '../../config-provider';
import useToken from '../../theme/useToken';
import { TARGET_CLS, type ShowWave } from './interface';
import { TARGET_CLS } from './interface';
import type { ShowWave } from './interface';
import showWaveEffect from './WaveEffect';
const useWave = (

View File

@ -9,11 +9,11 @@ import classNames from 'classnames';
import CSSMotion from 'rc-motion';
import pickAttrs from 'rc-util/lib/pickAttrs';
import type { ClosableType } from '../_util/hooks/useClosable';
import { replaceElement } from '../_util/reactNode';
import { devUseWarning } from '../_util/warning';
import { ConfigContext } from '../config-provider';
import useStyle from './style';
import type { ClosableType } from '../_util/hooks/useClosable';
export interface AlertProps {
/** Type of Alert styles, options:`success`, `info`, `warning`, `error` */

View File

@ -1,4 +1,5 @@
import * as React from 'react';
import Alert from './Alert';
interface ErrorBoundaryProps {

View File

@ -1,6 +1,7 @@
import React from 'react';
import userEvent from '@testing-library/user-event';
import { resetWarned } from 'rc-util/lib/warning';
import React from 'react';
import Alert from '..';
import accessibilityTest from '../../../tests/shared/accessibilityTest';
import rtlTest from '../../../tests/shared/rtlTest';

View File

@ -1,6 +1,6 @@
import React from 'react';
import { Alert, Space } from 'antd';
import { CloseSquareFilled } from '@ant-design/icons';
import { Alert, Space } from 'antd';
const onClose = (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => {
console.log(e, 'I was closed.');

View File

@ -1,5 +1,5 @@
import { SmileOutlined } from '@ant-design/icons';
import React from 'react';
import { SmileOutlined } from '@ant-design/icons';
import { Alert, ConfigProvider } from 'antd';
const icon = <SmileOutlined />;

View File

@ -1,6 +1,6 @@
import React from 'react';
import Marquee from 'react-fast-marquee';
import { Alert } from 'antd';
import Marquee from 'react-fast-marquee';
const App: React.FC = () => (
<Alert

View File

@ -1,5 +1,5 @@
import React, { useState } from 'react';
import { Alert, Switch, Space } from 'antd';
import { Alert, Space, Switch } from 'antd';
const App: React.FC = () => {
const [visible, setVisible] = useState(true);

View File

@ -1,4 +1,5 @@
import type React from 'react';
import type { AlertProps } from './Alert';
import InternalAlert from './Alert';
import ErrorBoundary from './ErrorBoundary';

View File

@ -1,5 +1,5 @@
import { resetWarned } from 'rc-util/lib/warning';
import React, { useState } from 'react';
import { resetWarned } from 'rc-util/lib/warning';
import scrollIntoView from 'scroll-into-view-if-needed';
import Anchor from '..';

View File

@ -1,4 +1,5 @@
import React, { memo, useContext } from 'react';
import { fireEvent, pureRender } from '../../../tests/utils';
import Anchor from '../Anchor';
import AnchorContext from '../context';

View File

@ -1,4 +1,5 @@
import * as React from 'react';
import demoTest, { rootPropsTest } from '../../../tests/shared/demoTest';
demoTest('anchor', {

View File

@ -1,4 +1,5 @@
import * as React from 'react';
import type { AntAnchor } from './Anchor';
const AnchorContext = React.createContext<AntAnchor | undefined>(undefined);

View File

@ -1,5 +1,5 @@
import React from 'react';
import { Anchor, Row, Col } from 'antd';
import { Anchor, Col, Row } from 'antd';
const App: React.FC = () => (
<Row>

View File

@ -1,5 +1,5 @@
import React, { useEffect, useState } from 'react';
import { Anchor, Row, Col } from 'antd';
import { Anchor, Col, Row } from 'antd';
const App: React.FC = () => {
const topRef = React.useRef<HTMLDivElement>(null);

View File

@ -1,4 +1,5 @@
import * as React from 'react';
import demoTest, { rootPropsTest } from '../../../tests/shared/demoTest';
demoTest('auto-complete', {

View File

@ -1,5 +1,6 @@
import React from 'react';
import { act } from 'react-dom/test-utils';
import AutoComplete from '..';
import { render } from '../../../tests/utils';

View File

@ -1,10 +1,11 @@
import userEvent from '@testing-library/user-event';
import React from 'react';
import userEvent from '@testing-library/user-event';
import AutoComplete from '..';
import { resetWarned } from '../../_util/warning';
import mountTest from '../../../tests/shared/mountTest';
import rtlTest from '../../../tests/shared/rtlTest';
import { render, screen } from '../../../tests/utils';
import { resetWarned } from '../../_util/warning';
import Input from '../../input';
describe('AutoComplete', () => {

View File

@ -1,5 +1,5 @@
import React from 'react';
import { AutoComplete, Switch, Space } from 'antd';
import { AutoComplete, Space, Switch } from 'antd';
const { _InternalPanelDoNotUseOrYouWillBeFired: InternalAutoComplete } = AutoComplete;

View File

@ -1,4 +1,5 @@
import * as React from 'react';
import type { ScreenSizeMap } from '../_util/responsiveObserver';
export type AvatarSize = 'large' | 'small' | 'default' | number | ScreenSizeMap;

View File

@ -1,10 +1,11 @@
import React, { useState } from 'react';
import Avatar from '..';
import mountTest from '../../../tests/shared/mountTest';
import rtlTest from '../../../tests/shared/rtlTest';
import { fireEvent, render } from '../../../tests/utils';
import useBreakpoint from '../../grid/hooks/useBreakpoint';
import ConfigProvider from '../../config-provider';
import useBreakpoint from '../../grid/hooks/useBreakpoint';
jest.mock('../../grid/hooks/useBreakpoint');

View File

@ -1,4 +1,5 @@
import * as React from 'react';
import demoTest, { rootPropsTest } from '../../../tests/shared/demoTest';
demoTest('avatar');

View File

@ -1,5 +1,5 @@
import { UserOutlined } from '@ant-design/icons';
import React from 'react';
import { UserOutlined } from '@ant-design/icons';
import { Avatar, Badge, Space } from 'antd';
const App: React.FC = () => (

View File

@ -1,5 +1,5 @@
import { UserOutlined } from '@ant-design/icons';
import React from 'react';
import { UserOutlined } from '@ant-design/icons';
import { Avatar, Space } from 'antd';
const App: React.FC = () => (

View File

@ -1,5 +1,5 @@
import { AntDesignOutlined, UserOutlined } from '@ant-design/icons';
import React from 'react';
import { AntDesignOutlined, UserOutlined } from '@ant-design/icons';
import { Avatar, Badge, ConfigProvider, Space, Tooltip } from 'antd';
const App: React.FC = () => (

View File

@ -1,5 +1,5 @@
import { AntDesignOutlined, UserOutlined } from '@ant-design/icons';
import React from 'react';
import { AntDesignOutlined, UserOutlined } from '@ant-design/icons';
import { Avatar, Divider, Tooltip } from 'antd';
const App: React.FC = () => (

View File

@ -1,5 +1,5 @@
import { UserOutlined } from '@ant-design/icons';
import React from 'react';
import { UserOutlined } from '@ant-design/icons';
import { Avatar, Space } from 'antd';
const url = 'https://gw.alipayobjects.com/zos/rmsportal/KDpgvguMpGfqaHPjicRK.svg';

View File

@ -1,14 +1,15 @@
import * as React from 'react';
import classNames from 'classnames';
import toArray from 'rc-util/lib/Children/toArray';
import * as React from 'react';
import { ConfigContext } from '../config-provider';
import Popover from '../popover';
import { cloneElement } from '../_util/reactNode';
import { ConfigContext } from '../config-provider';
import useCSSVarCls from '../config-provider/hooks/useCSSVarCls';
import Popover from '../popover';
import Avatar from './avatar';
import AvatarContext from './AvatarContext';
import type { AvatarContextType, AvatarSize } from './AvatarContext';
import useStyle from './style';
import useCSSVarCls from '../config-provider/hooks/useCSSVarCls';
interface ContextProps {
children?: React.ReactNode;

View File

@ -1,4 +1,5 @@
import type { ForwardRefExoticComponent, RefAttributes } from 'react';
import type { AvatarProps } from './avatar';
import InternalAvatar from './avatar';
import Group from './group';

View File

@ -1,4 +1,5 @@
import { type CSSObject, unit } from '@ant-design/cssinjs';
import { unit } from '@ant-design/cssinjs';
import type { CSSObject } from '@ant-design/cssinjs';
import { resetComponent } from '../../style';
import type { FullToken, GenerateStyle, GetDefaultToken } from '../../theme/internal';

View File

@ -1,4 +1,5 @@
import React from 'react';
import BackTop from '..';
import mountTest from '../../../tests/shared/mountTest';
import rtlTest from '../../../tests/shared/rtlTest';

View File

@ -1,4 +1,5 @@
import { type CSSObject, unit } from '@ant-design/cssinjs';
import { unit } from '@ant-design/cssinjs';
import type { CSSObject } from '@ant-design/cssinjs';
import { resetComponent } from '../../style';
import type { FullToken, GenerateStyle, GetDefaultToken } from '../../theme/internal';

View File

@ -1,5 +1,6 @@
import classNames from 'classnames';
import * as React from 'react';
import classNames from 'classnames';
import { cloneElement } from '../_util/reactNode';
import { ConfigContext } from '../config-provider';
import SingleNumber from './SingleNumber';

View File

@ -1,5 +1,5 @@
import classNames from 'classnames';
import * as React from 'react';
import classNames from 'classnames';
export interface UnitNumberProps {
prefixCls: string;

View File

@ -1,4 +1,5 @@
import * as React from 'react';
import demoTest, { rootPropsTest } from '../../../tests/shared/demoTest';
demoTest('badge');

View File

@ -1,6 +1,7 @@
import { fireEvent, render } from '@testing-library/react';
import React from 'react';
import { fireEvent, render } from '@testing-library/react';
import { act } from 'react-dom/test-utils';
import mountTest from '../../../tests/shared/mountTest';
import rtlTest from '../../../tests/shared/rtlTest';
import Tooltip from '../../tooltip';

View File

@ -1,5 +1,6 @@
import { render } from '@testing-library/react';
import React from 'react';
import { render } from '@testing-library/react';
import mountTest from '../../../tests/shared/mountTest';
import rtlTest from '../../../tests/shared/rtlTest';
import Badge from '../index';

View File

@ -1,6 +1,6 @@
import React, { useState } from 'react';
import { MinusOutlined, PlusOutlined, QuestionOutlined } from '@ant-design/icons';
import { Avatar, Badge, Button, Switch, Space } from 'antd';
import { Avatar, Badge, Button, Space, Switch } from 'antd';
const ButtonGroup = Button.Group;

View File

@ -1,5 +1,5 @@
import { NotificationOutlined } from '@ant-design/icons';
import React from 'react';
import { NotificationOutlined } from '@ant-design/icons';
import { Avatar, Badge, ConfigProvider, Space } from 'antd';
/** Test usage. Do not use in your production. */

View File

@ -8,7 +8,7 @@ const App: React.FC = () => {
return (
<Space>
<Switch checked={show} onChange={() => setShow(!show)} />
<Badge count={show ? 11 : 0} showZero color='#faad14' />
<Badge count={show ? 11 : 0} showZero color="#faad14" />
<Badge count={show ? 25 : 0} />
<Badge count={show ? <ClockCircleOutlined style={{ color: '#f5222d' }} /> : 0} />
<Badge

View File

@ -1,6 +1,7 @@
import { unit } from '@ant-design/cssinjs';
import { type BadgeToken, prepareComponentToken, prepareToken } from '.';
import { prepareComponentToken, prepareToken } from '.';
import type { BadgeToken } from '.';
import { resetComponent } from '../../style';
import type { GenerateStyle } from '../../theme/internal';
import { genPresetColor, genStyleHooks } from '../../theme/internal';

View File

@ -1,12 +1,13 @@
import DownOutlined from '@ant-design/icons/DownOutlined';
import * as React from 'react';
import DownOutlined from '@ant-design/icons/DownOutlined';
import { devUseWarning } from '../_util/warning';
import { ConfigContext } from '../config-provider';
import type { DropdownProps } from '../dropdown/dropdown';
import Dropdown from '../dropdown/dropdown';
import type { ItemType } from './Breadcrumb';
import BreadcrumbSeparator from './BreadcrumbSeparator';
import { renderItem } from './useItemRender';
import { devUseWarning } from '../_util/warning';
export interface SeparatorType {
separator?: React.ReactNode;

View File

@ -1,4 +1,5 @@
import * as React from 'react';
import { ConfigContext } from '../config-provider';
type CompoundedComponent = React.FC<{ children?: React.ReactNode }> & {

View File

@ -1,9 +1,10 @@
import React from 'react';
import { resetWarned } from '../../_util/warning';
import accessibilityTest from '../../../tests/shared/accessibilityTest';
import mountTest from '../../../tests/shared/mountTest';
import rtlTest from '../../../tests/shared/rtlTest';
import { render } from '../../../tests/utils';
import { resetWarned } from '../../_util/warning';
import type { ItemType } from '../Breadcrumb';
import Breadcrumb from '../index';

View File

@ -1,4 +1,5 @@
import React from 'react';
import { render } from '../../../tests/utils';
import Breadcrumb from '../index';

View File

@ -1,6 +1,7 @@
import React, { useMemo } from 'react';
import type { RouterProps } from 'react-router-dom';
import { Link, MemoryRouter, Route, Routes, useLocation, useNavigate } from 'react-router-dom';
import { fireEvent, render } from '../../../tests/utils';
import Breadcrumb from '../index';
@ -51,11 +52,11 @@ describe('react router', () => {
</Breadcrumb.Item>,
].concat(extraBreadcrumbItems);
const componentProps = useMemo<RouterProps>(
() => ({ component: Apps } as unknown as RouterProps),
() => ({ component: Apps }) as unknown as RouterProps,
[],
);
const renderProps = useMemo<RouterProps>(
() => ({ render: () => <span>Home Page</span> } as unknown as RouterProps),
() => ({ render: () => <span>Home Page</span> }) as unknown as RouterProps,
[],
);
return (

View File

@ -1,5 +1,5 @@
import { HomeOutlined, UserOutlined } from '@ant-design/icons';
import React from 'react';
import { HomeOutlined, UserOutlined } from '@ant-design/icons';
import { Breadcrumb, ConfigProvider } from 'antd';
const menuItems = [

View File

@ -1,5 +1,5 @@
import { HomeOutlined, UserOutlined } from '@ant-design/icons';
import React from 'react';
import { HomeOutlined, UserOutlined } from '@ant-design/icons';
import { Breadcrumb } from 'antd';
const App: React.FC = () => (

View File

@ -1,4 +1,5 @@
import { type CSSObject, unit } from '@ant-design/cssinjs';
import { unit } from '@ant-design/cssinjs';
import type { CSSObject } from '@ant-design/cssinjs';
import { genFocusStyle, resetComponent } from '../../style';
import type { FullToken, GenerateStyle, GetDefaultToken } from '../../theme/internal';

View File

@ -1,6 +1,7 @@
import * as React from 'react';
import classNames from 'classnames';
import pickAttrs from 'rc-util/lib/pickAttrs';
import * as React from 'react';
import type { BreadcrumbProps, InternalRouteType, ItemType } from './Breadcrumb';
type AddParameters<TFunction extends (...args: any) => any, TParameters extends [...args: any]> = (

View File

@ -1,4 +1,5 @@
import { useMemo } from 'react';
import type { BreadcrumbItemType, BreadcrumbSeparatorType, ItemType } from './Breadcrumb';
type MergedType = BreadcrumbItemType & {

View File

@ -1,7 +1,8 @@
import React, { forwardRef } from 'react';
import LoadingOutlined from '@ant-design/icons/LoadingOutlined';
import classNames from 'classnames';
import CSSMotion from 'rc-motion';
import React, { forwardRef } from 'react';
import IconWrapper from './IconWrapper';
type InnerLoadingIconProps = {

View File

@ -1,5 +1,6 @@
import React, { useState } from 'react';
import { act } from 'react-dom/test-utils';
import { fireEvent, render } from '../../../tests/utils';
import Button from '../button';

View File

@ -1,5 +1,6 @@
import userEvent from '@testing-library/user-event';
import React from 'react';
import userEvent from '@testing-library/user-event';
import Button from '..';
import { act, fireEvent, render } from '../../../tests/utils';

View File

@ -1,4 +1,5 @@
import React from 'react';
import { cloneElement, isFragment } from '../_util/reactNode';
import type { BaseButtonProps, LegacyButtonType } from './button';
@ -75,10 +76,10 @@ export function spaceChildren(children: React.ReactNode, needInserted: boolean)
}
const ButtonTypes = ['default', 'primary', 'dashed', 'link', 'text'] as const;
export type ButtonType = typeof ButtonTypes[number];
export type ButtonType = (typeof ButtonTypes)[number];
const ButtonShapes = ['default', 'circle', 'round'] as const;
export type ButtonShape = typeof ButtonShapes[number];
export type ButtonShape = (typeof ButtonShapes)[number];
const ButtonHTMLTypes = ['submit', 'button', 'reset'] as const;
export type ButtonHTMLType = typeof ButtonHTMLTypes[number];
export type ButtonHTMLType = (typeof ButtonHTMLTypes)[number];

View File

@ -1,6 +1,6 @@
import React from 'react';
import { DownloadOutlined } from '@ant-design/icons';
import { Form, Button } from 'antd';
import { Button, Form } from 'antd';
const App: React.FC = () => (
<Form>

View File

@ -1,14 +1,7 @@
import React from 'react';
import { SearchOutlined } from '@ant-design/icons';
import {
Button,
ConfigProvider,
Divider,
Flex,
Radio,
Tooltip,
type ConfigProviderProps,
} from 'antd';
import { Button, ConfigProvider, Divider, Flex, Radio, Tooltip } from 'antd';
import type { ConfigProviderProps } from 'antd';
type SizeType = ConfigProviderProps['componentSize'];

View File

@ -1,6 +1,6 @@
import React from 'react';
import { Button, ConfigProvider, Space } from 'antd';
import { TinyColor } from '@ctrl/tinycolor';
import { Button, ConfigProvider, Space } from 'antd';
const colors1 = ['#6253E1', '#04BEFE'];
const colors2 = ['#fc6076', '#ff9a44', '#ef9d43', '#e75516'];

View File

@ -1,11 +1,12 @@
// Style as inline component
import type { ButtonToken } from './token';
import { prepareComponentToken, prepareToken } from './token';
import { unit } from '@ant-design/cssinjs';
import { genCompactItemStyle } from '../../style/compact-item';
import { genCompactItemVerticalStyle } from '../../style/compact-item-vertical';
import type { GenerateStyle } from '../../theme/internal';
import { genSubStyleComponent } from '../../theme/internal';
import { unit } from '@ant-design/cssinjs';
import type { ButtonToken } from './token';
import { prepareComponentToken, prepareToken } from './token';
const genButtonCompactStyle: GenerateStyle<ButtonToken> = (token) => {
const { componentCls, calc } = token;

View File

@ -1,5 +1,5 @@
import type { ButtonToken } from './token';
import type { GenerateStyle } from '../../theme/internal';
import type { ButtonToken } from './token';
const genButtonBorderStyle = (buttonTypeCls: string, borderColor: string) => ({
// Border

View File

@ -1,4 +1,5 @@
import type { CSSProperties } from 'react';
import type { FullToken, GetDefaultToken } from '../../theme/internal';
import { getLineHeight, mergeToken } from '../../theme/internal';
import type { GenStyleFn } from '../../theme/util/genComponentStyleHook';

View File

@ -1,7 +1,8 @@
import type { GenerateConfig } from 'rc-picker/lib/generate';
import type { Locale } from 'rc-picker/lib/interface';
import * as React from 'react';
import { useContext, useMemo } from 'react';
import type { GenerateConfig } from 'rc-picker/lib/generate';
import type { Locale } from 'rc-picker/lib/interface';
import { FormItemInputContext } from '../form/context';
import { Button, Group } from '../radio';
import Select from '../select';

View File

@ -1,4 +1,5 @@
import dayjs from 'dayjs';
import demoTest from '../../../tests/shared/demoTest';
demoTest('calendar', {

View File

@ -4,7 +4,7 @@ import 'dayjs/locale/zh-cn';
import React from 'react';
import MockDate from 'mockdate';
import { type PickerPanelProps } from 'rc-picker';
import type { PickerPanelProps } from 'rc-picker';
import dayjsGenerateConfig from 'rc-picker/lib/generate/dayjs';
import type { Locale } from 'rc-picker/lib/interface';
import { resetWarned } from 'rc-util/lib/warning';
@ -16,7 +16,8 @@ import { fireEvent, render } from '../../../tests/utils';
import Group from '../../radio/group';
import Button from '../../radio/radioButton';
import Select from '../../select';
import Header, { type CalendarHeaderProps } from '../Header';
import Header from '../Header';
import type { CalendarHeaderProps } from '../Header';
const ref: {
calendarProps?: PickerPanelProps;

View File

@ -1,7 +1,7 @@
import React from 'react';
import type { Dayjs } from 'dayjs';
import { Calendar } from 'antd';
import type { CalendarProps } from 'antd';
import type { Dayjs } from 'dayjs';
const App: React.FC = () => {
const onPanelChange = (value: Dayjs, mode: CalendarProps<Dayjs>['mode']) => {

View File

@ -1,7 +1,7 @@
import type { Dayjs } from 'dayjs';
import React from 'react';
import { Calendar, theme } from 'antd';
import type { CalendarProps } from 'antd';
import type { Dayjs } from 'dayjs';
const onPanelChange = (value: Dayjs, mode: CalendarProps<Dayjs>['mode']) => {
console.log(value.format('YYYY-MM-DD'), mode);

View File

@ -1,7 +1,7 @@
import type { Dayjs } from 'dayjs';
import React from 'react';
import { Calendar, ConfigProvider } from 'antd';
import type { CalendarProps } from 'antd';
import type { Dayjs } from 'dayjs';
/** Test usage. Do not use in your production. */
export default () => {

View File

@ -1,10 +1,12 @@
import React from 'react';
import dayjs from 'dayjs';
import 'dayjs/locale/zh-cn';
import { Calendar, Col, Radio, Row, Select, theme, Typography } from 'antd';
import type { CalendarProps } from 'antd';
import type { Dayjs } from 'dayjs';
import dayLocaleData from 'dayjs/plugin/localeData';
import { Calendar, Col, Radio, Row, Select, Typography, theme } from 'antd';
import type { CalendarProps } from 'antd';
dayjs.extend(dayLocaleData);

View File

@ -1,11 +1,11 @@
import dayjs from 'dayjs';
import type { Dayjs } from 'dayjs';
import React from 'react';
import { Lunar, HolidayUtil } from 'lunar-typescript';
import { createStyles } from 'antd-style';
import classNames from 'classnames';
import { Calendar, Col, Radio, Row, Select } from 'antd';
import type { CalendarProps } from 'antd';
import { createStyles } from 'antd-style';
import classNames from 'classnames';
import dayjs from 'dayjs';
import type { Dayjs } from 'dayjs';
import { HolidayUtil, Lunar } from 'lunar-typescript';
const useStyle = createStyles(({ token, css, cx }) => {
const lunar = css`

View File

@ -1,7 +1,7 @@
import React from 'react';
import type { Dayjs } from 'dayjs';
import type { BadgeProps, CalendarProps } from 'antd';
import { Badge, Calendar } from 'antd';
import type { Dayjs } from 'dayjs';
const getListData = (value: Dayjs) => {
let listData;

View File

@ -1,7 +1,7 @@
import React, { useState } from 'react';
import { Alert, Calendar } from 'antd';
import type { Dayjs } from 'dayjs';
import dayjs from 'dayjs';
import { Alert, Calendar } from 'antd';
const App: React.FC = () => {
const [value, setValue] = useState(() => dayjs('2017-01-25'));

View File

@ -1,5 +1,6 @@
import type { Dayjs } from 'dayjs';
import dayjsGenerateConfig from 'rc-picker/lib/generate/dayjs';
import type { CalendarProps } from './generateCalendar';
import generateCalendar from './generateCalendar';

View File

@ -1,5 +1,6 @@
import classNames from 'classnames';
import * as React from 'react';
import classNames from 'classnames';
import { ConfigContext } from '../config-provider';
import type { ConfigConsumerProps } from '../config-provider';

View File

@ -1,5 +1,6 @@
import classNames from 'classnames';
import * as React from 'react';
import classNames from 'classnames';
import type { ConfigConsumerProps } from '../config-provider';
import { ConfigContext } from '../config-provider';

View File

@ -1,6 +1,8 @@
import '@testing-library/jest-dom';
import userEvent from '@testing-library/user-event';
import React from 'react';
import userEvent from '@testing-library/user-event';
import mountTest from '../../../tests/shared/mountTest';
import rtlTest from '../../../tests/shared/rtlTest';
import { render, screen } from '../../../tests/utils';

View File

@ -1,4 +1,5 @@
import * as React from 'react';
import Card from '../index';
describe('Card.typescript', () => {

View File

@ -1,5 +1,5 @@
import { EditOutlined, EllipsisOutlined, SettingOutlined } from '@ant-design/icons';
import React from 'react';
import { EditOutlined, EllipsisOutlined, SettingOutlined } from '@ant-design/icons';
import { Card, ConfigProvider } from 'antd';
export default () => (

Some files were not shown because too many files have changed in this diff Show More