Skip to content

Commit

Permalink
chore: adjust hor style
Browse files Browse the repository at this point in the history
  • Loading branch information
zombieJ committed Apr 8, 2024
2 parents 12de99a + 502dac1 commit 9a5fd42
Show file tree
Hide file tree
Showing 628 changed files with 1,106 additions and 591 deletions.
3 changes: 2 additions & 1 deletion .dumi/rehypeAntd.ts
Original file line number Diff line number Diff line change
@@ -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
Expand Down
3 changes: 2 additions & 1 deletion .dumi/theme/builtins/ColorChunk/index.tsx
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
3 changes: 2 additions & 1 deletion .dumi/theme/builtins/ComponentMeta/index.tsx
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
2 changes: 1 addition & 1 deletion .dumi/theme/builtins/Container/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
5 changes: 3 additions & 2 deletions .dumi/theme/common/CodePreview.tsx
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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];
}
Expand Down
2 changes: 1 addition & 1 deletion .dumi/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
"compilerOptions": {
"resolveJsonModule": true
},
"include": ["**/*"]
"include": ["**/*", "../typings/index.d.ts"]
}
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
},
{
Expand Down
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,4 @@ components/*/*.jsx
.eslintignore
.history
**/*.yml
*.html
1 change: 1 addition & 0 deletions components/__tests__/setup.test.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as React from 'react';

import { render } from '../../tests/utils';

describe('SetUp.Test', () => {
Expand Down
3 changes: 2 additions & 1 deletion components/_util/ActionButton.tsx
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
1 change: 1 addition & 0 deletions components/_util/__tests__/responsiveObserve.test.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React from 'react';

import { render } from '../../../tests/utils';
import useResponsiveObserver from '../responsiveObserver';

Expand Down
3 changes: 2 additions & 1 deletion components/_util/__tests__/transButton.test.tsx
Original file line number Diff line number Diff line change
@@ -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', () => {
Expand Down
3 changes: 2 additions & 1 deletion components/_util/__tests__/useSyncState.test.tsx
Original file line number Diff line number Diff line change
@@ -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', () => {
Expand Down
3 changes: 2 additions & 1 deletion components/_util/__tests__/util.test.tsx
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
3 changes: 2 additions & 1 deletion components/_util/__tests__/warning.test.tsx
Original file line number Diff line number Diff line change
@@ -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', () => {
Expand Down
3 changes: 2 additions & 1 deletion components/_util/__tests__/wave.test.tsx
Original file line number Diff line number Diff line change
@@ -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;

Expand Down
2 changes: 1 addition & 1 deletion components/_util/colors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}.
Expand Down
3 changes: 2 additions & 1 deletion components/_util/hooks/useProxyImperativeHandle.ts
Original file line number Diff line number Diff line change
@@ -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> },
Expand Down
2 changes: 1 addition & 1 deletion components/_util/motion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
1 change: 1 addition & 0 deletions components/_util/scrollTo.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import raf from 'rc-util/lib/raf';

import { easeInOutCubic } from './easings';
import getScroll, { isWindow } from './getScroll';

Expand Down
3 changes: 2 additions & 1 deletion components/_util/statusUtils.ts
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
2 changes: 1 addition & 1 deletion components/_util/transButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion components/_util/wave/WaveEffect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
3 changes: 2 additions & 1 deletion components/_util/wave/useWave.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = (
Expand Down
2 changes: 1 addition & 1 deletion components/alert/Alert.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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` */
Expand Down
1 change: 1 addition & 0 deletions components/alert/ErrorBoundary.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as React from 'react';

import Alert from './Alert';

interface ErrorBoundaryProps {
Expand Down
3 changes: 2 additions & 1 deletion components/alert/__tests__/index.test.tsx
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
2 changes: 1 addition & 1 deletion components/alert/demo/closable.tsx
Original file line number Diff line number Diff line change
@@ -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.');
Expand Down
2 changes: 1 addition & 1 deletion components/alert/demo/component-token.tsx
Original file line number Diff line number Diff line change
@@ -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 />;
Expand Down
2 changes: 1 addition & 1 deletion components/alert/demo/loop-banner.tsx
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion components/alert/demo/smooth-closed.tsx
Original file line number Diff line number Diff line change
@@ -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);
Expand Down
1 change: 1 addition & 0 deletions components/alert/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type React from 'react';

import type { AlertProps } from './Alert';
import InternalAlert from './Alert';
import ErrorBoundary from './ErrorBoundary';
Expand Down
2 changes: 1 addition & 1 deletion components/anchor/__tests__/Anchor.test.tsx
Original file line number Diff line number Diff line change
@@ -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 '..';
Expand Down
1 change: 1 addition & 0 deletions components/anchor/__tests__/cached-context.test.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { memo, useContext } from 'react';

import { fireEvent, pureRender } from '../../../tests/utils';
import Anchor from '../Anchor';
import AnchorContext from '../context';
Expand Down
1 change: 1 addition & 0 deletions components/anchor/__tests__/demo.test.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as React from 'react';

import demoTest, { rootPropsTest } from '../../../tests/shared/demoTest';

demoTest('anchor', {
Expand Down
1 change: 1 addition & 0 deletions components/anchor/context.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as React from 'react';

import type { AntAnchor } from './Anchor';

const AnchorContext = React.createContext<AntAnchor | undefined>(undefined);
Expand Down
2 changes: 1 addition & 1 deletion components/anchor/demo/basic.tsx
Original file line number Diff line number Diff line change
@@ -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>
Expand Down
2 changes: 1 addition & 1 deletion components/anchor/demo/targetOffset.tsx
Original file line number Diff line number Diff line change
@@ -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);
Expand Down
1 change: 1 addition & 0 deletions components/auto-complete/__tests__/demo.test.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as React from 'react';

import demoTest, { rootPropsTest } from '../../../tests/shared/demoTest';

demoTest('auto-complete', {
Expand Down
1 change: 1 addition & 0 deletions components/auto-complete/__tests__/focus.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React from 'react';
import { act } from 'react-dom/test-utils';

import AutoComplete from '..';
import { render } from '../../../tests/utils';

Expand Down
5 changes: 3 additions & 2 deletions components/auto-complete/__tests__/index.test.tsx
Original file line number Diff line number Diff line change
@@ -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', () => {
Expand Down
2 changes: 1 addition & 1 deletion components/auto-complete/demo/render-panel.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { AutoComplete, Switch, Space } from 'antd';
import { AutoComplete, Space, Switch } from 'antd';

const { _InternalPanelDoNotUseOrYouWillBeFired: InternalAutoComplete } = AutoComplete;

Expand Down
1 change: 1 addition & 0 deletions components/avatar/AvatarContext.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as React from 'react';

import type { ScreenSizeMap } from '../_util/responsiveObserver';

export type AvatarSize = 'large' | 'small' | 'default' | number | ScreenSizeMap;
Expand Down
3 changes: 2 additions & 1 deletion components/avatar/__tests__/Avatar.test.tsx
Original file line number Diff line number Diff line change
@@ -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');

Expand Down
1 change: 1 addition & 0 deletions components/avatar/__tests__/demo.test.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as React from 'react';

import demoTest, { rootPropsTest } from '../../../tests/shared/demoTest';

demoTest('avatar');
Expand Down
2 changes: 1 addition & 1 deletion components/avatar/demo/badge.tsx
Original file line number Diff line number Diff line change
@@ -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 = () => (
Expand Down
2 changes: 1 addition & 1 deletion components/avatar/demo/basic.tsx
Original file line number Diff line number Diff line change
@@ -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 = () => (
Expand Down
2 changes: 1 addition & 1 deletion components/avatar/demo/component-token.tsx
Original file line number Diff line number Diff line change
@@ -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 = () => (
Expand Down

0 comments on commit 9a5fd42

Please sign in to comment.