mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-27 12:39:49 +08:00
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:
parent
a125dfee8b
commit
502dac12aa
@ -1,5 +1,6 @@
|
|||||||
import assert from 'assert';
|
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
|
* plugin for modify hast tree when docs compiling
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import * as React from 'react';
|
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';
|
import { createStyles } from 'antd-style';
|
||||||
|
|
||||||
interface ColorChunkProps {
|
interface ColorChunkProps {
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { EditOutlined, GithubOutlined } from '@ant-design/icons';
|
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 { createStyles, css } from 'antd-style';
|
||||||
import kebabCase from 'lodash/kebabCase';
|
import kebabCase from 'lodash/kebabCase';
|
||||||
import CopyToClipboard from 'react-copy-to-clipboard';
|
import CopyToClipboard from 'react-copy-to-clipboard';
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
* copied: https://github.com/arvinxx/dumi-theme-antd-style/tree/master/src/builtins/Container
|
* copied: https://github.com/arvinxx/dumi-theme-antd-style/tree/master/src/builtins/Container
|
||||||
*/
|
*/
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import { type FC, type ReactNode } from 'react';
|
import type { FC, ReactNode } from 'react';
|
||||||
import { Alert } from 'antd';
|
import { Alert } from 'antd';
|
||||||
|
|
||||||
import useStyles from './style';
|
import useStyles from './style';
|
||||||
|
@ -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 { Button, Tabs, Typography } from 'antd';
|
||||||
import { createStyles } from 'antd-style';
|
import { createStyles } from 'antd-style';
|
||||||
import toReactElement from 'jsonml-to-react-element';
|
import toReactElement from 'jsonml-to-react-element';
|
||||||
@ -120,7 +121,7 @@ const CodePreview: React.FC<CodePreviewProps> = ({
|
|||||||
style: Prism.highlight(styleCode, Prism.languages.css, 'css'),
|
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]) {
|
if (!codes[key]) {
|
||||||
delete codes[key];
|
delete codes[key];
|
||||||
}
|
}
|
||||||
|
@ -3,5 +3,5 @@
|
|||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"resolveJsonModule": true
|
"resolveJsonModule": true
|
||||||
},
|
},
|
||||||
"include": ["**/*"]
|
"include": ["**/*", "../typings/index.d.ts"]
|
||||||
}
|
}
|
||||||
|
@ -44,6 +44,7 @@ module.exports = {
|
|||||||
'no-unused-expressions': 'off',
|
'no-unused-expressions': 'off',
|
||||||
'@typescript-eslint/no-unused-expressions': 2,
|
'@typescript-eslint/no-unused-expressions': 2,
|
||||||
'@typescript-eslint/consistent-type-imports': [2, { disallowTypeAnnotations: false }],
|
'@typescript-eslint/consistent-type-imports': [2, { disallowTypeAnnotations: false }],
|
||||||
|
'import/consistent-type-specifier-style': 2,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -31,3 +31,4 @@ components/*/*.jsx
|
|||||||
.eslintignore
|
.eslintignore
|
||||||
.history
|
.history
|
||||||
**/*.yml
|
**/*.yml
|
||||||
|
*.html
|
@ -1,4 +1,5 @@
|
|||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
|
|
||||||
import { render } from '../../tests/utils';
|
import { render } from '../../tests/utils';
|
||||||
|
|
||||||
describe('SetUp.Test', () => {
|
describe('SetUp.Test', () => {
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import useState from 'rc-util/lib/hooks/useState';
|
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
|
import useState from 'rc-util/lib/hooks/useState';
|
||||||
|
|
||||||
import Button from '../button';
|
import Button from '../button';
|
||||||
import type { ButtonProps, LegacyButtonType } from '../button/button';
|
import type { ButtonProps, LegacyButtonType } from '../button/button';
|
||||||
import { convertLegacyProps } from '../button/buttonHelpers';
|
import { convertLegacyProps } from '../button/buttonHelpers';
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
import { render } from '../../../tests/utils';
|
import { render } from '../../../tests/utils';
|
||||||
import useResponsiveObserver from '../responsiveObserver';
|
import useResponsiveObserver from '../responsiveObserver';
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import TransButton from '../transButton';
|
|
||||||
import { render } from '../../../tests/utils';
|
import { render } from '../../../tests/utils';
|
||||||
|
import TransButton from '../transButton';
|
||||||
|
|
||||||
describe('transButton component', () => {
|
describe('transButton component', () => {
|
||||||
it('disabled should update style', () => {
|
it('disabled should update style', () => {
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
|
import { fireEvent, render } from '../../../tests/utils';
|
||||||
import useSyncState from '../hooks/useSyncState';
|
import useSyncState from '../hooks/useSyncState';
|
||||||
import { render, fireEvent } from '../../../tests/utils';
|
|
||||||
|
|
||||||
describe('Table', () => {
|
describe('Table', () => {
|
||||||
it('useSyncState', () => {
|
it('useSyncState', () => {
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
/* eslint-disable class-methods-use-this */
|
/* eslint-disable class-methods-use-this */
|
||||||
import KeyCode from 'rc-util/lib/KeyCode';
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import KeyCode from 'rc-util/lib/KeyCode';
|
||||||
|
|
||||||
import { fireEvent, render, waitFakeTimer } from '../../../tests/utils';
|
import { fireEvent, render, waitFakeTimer } from '../../../tests/utils';
|
||||||
import { isStyleSupport } from '../styleChecker';
|
import { isStyleSupport } from '../styleChecker';
|
||||||
import throttleByAnimationFrame from '../throttleByAnimationFrame';
|
import throttleByAnimationFrame from '../throttleByAnimationFrame';
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import { render } from '@testing-library/react';
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import { render } from '@testing-library/react';
|
||||||
|
|
||||||
import { devUseWarning as useWarning } from '../warning';
|
import { devUseWarning as useWarning } from '../warning';
|
||||||
|
|
||||||
describe('Test warning', () => {
|
describe('Test warning', () => {
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
|
|
||||||
import mountTest from '../../../tests/shared/mountTest';
|
import mountTest from '../../../tests/shared/mountTest';
|
||||||
import { act, fireEvent, getByText, render, waitFakeTimer } from '../../../tests/utils';
|
import { act, fireEvent, getByText, render, waitFakeTimer } from '../../../tests/utils';
|
||||||
|
import Checkbox from '../../checkbox';
|
||||||
import Wave from '../wave';
|
import Wave from '../wave';
|
||||||
import { TARGET_CLS } from '../wave/interface';
|
import { TARGET_CLS } from '../wave/interface';
|
||||||
import Checkbox from '../../checkbox';
|
|
||||||
|
|
||||||
(global as any).isVisible = true;
|
(global as any).isVisible = true;
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ export const PresetStatusColorTypes = [
|
|||||||
|
|
||||||
export type PresetColorType = PresetColorKey | InverseColor;
|
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}.
|
* determine if the color keyword belongs to the `Ant Design` {@link PresetColors}.
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
// Proxy the dom ref with `{ nativeElement, otherFn }` type
|
// Proxy the dom ref with `{ nativeElement, otherFn }` type
|
||||||
// ref: https://github.com/ant-design/ant-design/discussions/45242
|
// 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(
|
function fillProxy(
|
||||||
element: HTMLElement & { _antProxy?: Record<string, any> },
|
element: HTMLElement & { _antProxy?: Record<string, any> },
|
||||||
|
@ -27,7 +27,7 @@ const initCollapseMotion = (rootCls: string = 'ant'): CSSMotionProps => ({
|
|||||||
|
|
||||||
const SelectPlacements = ['bottomLeft', 'bottomRight', 'topLeft', 'topRight'] as const;
|
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) => {
|
const getTransitionName = (rootPrefixCls: string, motion: string, transitionName?: string) => {
|
||||||
if (transitionName !== undefined) {
|
if (transitionName !== undefined) {
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import raf from 'rc-util/lib/raf';
|
import raf from 'rc-util/lib/raf';
|
||||||
|
|
||||||
import { easeInOutCubic } from './easings';
|
import { easeInOutCubic } from './easings';
|
||||||
import getScroll, { isWindow } from './getScroll';
|
import getScroll, { isWindow } from './getScroll';
|
||||||
|
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
|
|
||||||
import type { ValidateStatus } from '../form/FormItem';
|
import type { ValidateStatus } from '../form/FormItem';
|
||||||
|
|
||||||
const InputStatuses = ['warning', 'error', ''] as const;
|
const InputStatuses = ['warning', 'error', ''] as const;
|
||||||
|
|
||||||
export type InputStatus = typeof InputStatuses[number];
|
export type InputStatus = (typeof InputStatuses)[number];
|
||||||
|
|
||||||
export function getStatusClassNames(
|
export function getStatusClassNames(
|
||||||
prefixCls: string,
|
prefixCls: string,
|
||||||
|
@ -3,8 +3,8 @@
|
|||||||
*
|
*
|
||||||
* This helps accessibility reader to tread as a interactive button to operation.
|
* 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 * as React from 'react';
|
||||||
|
import KeyCode from 'rc-util/lib/KeyCode';
|
||||||
|
|
||||||
interface TransButtonProps extends React.HTMLAttributes<HTMLDivElement> {
|
interface TransButtonProps extends React.HTMLAttributes<HTMLDivElement> {
|
||||||
onClick?: (e?: React.MouseEvent<HTMLDivElement>) => void;
|
onClick?: (e?: React.MouseEvent<HTMLDivElement>) => void;
|
||||||
|
@ -4,7 +4,8 @@ import CSSMotion from 'rc-motion';
|
|||||||
import raf from 'rc-util/lib/raf';
|
import raf from 'rc-util/lib/raf';
|
||||||
import { render, unmount } from 'rc-util/lib/React/render';
|
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';
|
import { getTargetWaveColor } from './util';
|
||||||
|
|
||||||
function validateNum(value: number) {
|
function validateNum(value: number) {
|
||||||
|
@ -4,7 +4,8 @@ import raf from 'rc-util/lib/raf';
|
|||||||
|
|
||||||
import { ConfigContext } from '../../config-provider';
|
import { ConfigContext } from '../../config-provider';
|
||||||
import useToken from '../../theme/useToken';
|
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';
|
import showWaveEffect from './WaveEffect';
|
||||||
|
|
||||||
const useWave = (
|
const useWave = (
|
||||||
|
@ -9,11 +9,11 @@ import classNames from 'classnames';
|
|||||||
import CSSMotion from 'rc-motion';
|
import CSSMotion from 'rc-motion';
|
||||||
import pickAttrs from 'rc-util/lib/pickAttrs';
|
import pickAttrs from 'rc-util/lib/pickAttrs';
|
||||||
|
|
||||||
|
import type { ClosableType } from '../_util/hooks/useClosable';
|
||||||
import { replaceElement } from '../_util/reactNode';
|
import { replaceElement } from '../_util/reactNode';
|
||||||
import { devUseWarning } from '../_util/warning';
|
import { devUseWarning } from '../_util/warning';
|
||||||
import { ConfigContext } from '../config-provider';
|
import { ConfigContext } from '../config-provider';
|
||||||
import useStyle from './style';
|
import useStyle from './style';
|
||||||
import type { ClosableType } from '../_util/hooks/useClosable';
|
|
||||||
|
|
||||||
export interface AlertProps {
|
export interface AlertProps {
|
||||||
/** Type of Alert styles, options:`success`, `info`, `warning`, `error` */
|
/** Type of Alert styles, options:`success`, `info`, `warning`, `error` */
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
|
|
||||||
import Alert from './Alert';
|
import Alert from './Alert';
|
||||||
|
|
||||||
interface ErrorBoundaryProps {
|
interface ErrorBoundaryProps {
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
|
import React from 'react';
|
||||||
import userEvent from '@testing-library/user-event';
|
import userEvent from '@testing-library/user-event';
|
||||||
import { resetWarned } from 'rc-util/lib/warning';
|
import { resetWarned } from 'rc-util/lib/warning';
|
||||||
import React from 'react';
|
|
||||||
import Alert from '..';
|
import Alert from '..';
|
||||||
import accessibilityTest from '../../../tests/shared/accessibilityTest';
|
import accessibilityTest from '../../../tests/shared/accessibilityTest';
|
||||||
import rtlTest from '../../../tests/shared/rtlTest';
|
import rtlTest from '../../../tests/shared/rtlTest';
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { Alert, Space } from 'antd';
|
|
||||||
import { CloseSquareFilled } from '@ant-design/icons';
|
import { CloseSquareFilled } from '@ant-design/icons';
|
||||||
|
import { Alert, Space } from 'antd';
|
||||||
|
|
||||||
const onClose = (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => {
|
const onClose = (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => {
|
||||||
console.log(e, 'I was closed.');
|
console.log(e, 'I was closed.');
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { SmileOutlined } from '@ant-design/icons';
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import { SmileOutlined } from '@ant-design/icons';
|
||||||
import { Alert, ConfigProvider } from 'antd';
|
import { Alert, ConfigProvider } from 'antd';
|
||||||
|
|
||||||
const icon = <SmileOutlined />;
|
const icon = <SmileOutlined />;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import Marquee from 'react-fast-marquee';
|
|
||||||
import { Alert } from 'antd';
|
import { Alert } from 'antd';
|
||||||
|
import Marquee from 'react-fast-marquee';
|
||||||
|
|
||||||
const App: React.FC = () => (
|
const App: React.FC = () => (
|
||||||
<Alert
|
<Alert
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import React, { useState } from 'react';
|
import React, { useState } from 'react';
|
||||||
import { Alert, Switch, Space } from 'antd';
|
import { Alert, Space, Switch } from 'antd';
|
||||||
|
|
||||||
const App: React.FC = () => {
|
const App: React.FC = () => {
|
||||||
const [visible, setVisible] = useState(true);
|
const [visible, setVisible] = useState(true);
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import type React from 'react';
|
import type React from 'react';
|
||||||
|
|
||||||
import type { AlertProps } from './Alert';
|
import type { AlertProps } from './Alert';
|
||||||
import InternalAlert from './Alert';
|
import InternalAlert from './Alert';
|
||||||
import ErrorBoundary from './ErrorBoundary';
|
import ErrorBoundary from './ErrorBoundary';
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { resetWarned } from 'rc-util/lib/warning';
|
|
||||||
import React, { useState } from 'react';
|
import React, { useState } from 'react';
|
||||||
|
import { resetWarned } from 'rc-util/lib/warning';
|
||||||
import scrollIntoView from 'scroll-into-view-if-needed';
|
import scrollIntoView from 'scroll-into-view-if-needed';
|
||||||
|
|
||||||
import Anchor from '..';
|
import Anchor from '..';
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import React, { memo, useContext } from 'react';
|
import React, { memo, useContext } from 'react';
|
||||||
|
|
||||||
import { fireEvent, pureRender } from '../../../tests/utils';
|
import { fireEvent, pureRender } from '../../../tests/utils';
|
||||||
import Anchor from '../Anchor';
|
import Anchor from '../Anchor';
|
||||||
import AnchorContext from '../context';
|
import AnchorContext from '../context';
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
|
|
||||||
import demoTest, { rootPropsTest } from '../../../tests/shared/demoTest';
|
import demoTest, { rootPropsTest } from '../../../tests/shared/demoTest';
|
||||||
|
|
||||||
demoTest('anchor', {
|
demoTest('anchor', {
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
|
|
||||||
import type { AntAnchor } from './Anchor';
|
import type { AntAnchor } from './Anchor';
|
||||||
|
|
||||||
const AnchorContext = React.createContext<AntAnchor | undefined>(undefined);
|
const AnchorContext = React.createContext<AntAnchor | undefined>(undefined);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { Anchor, Row, Col } from 'antd';
|
import { Anchor, Col, Row } from 'antd';
|
||||||
|
|
||||||
const App: React.FC = () => (
|
const App: React.FC = () => (
|
||||||
<Row>
|
<Row>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import React, { useEffect, useState } from 'react';
|
import React, { useEffect, useState } from 'react';
|
||||||
import { Anchor, Row, Col } from 'antd';
|
import { Anchor, Col, Row } from 'antd';
|
||||||
|
|
||||||
const App: React.FC = () => {
|
const App: React.FC = () => {
|
||||||
const topRef = React.useRef<HTMLDivElement>(null);
|
const topRef = React.useRef<HTMLDivElement>(null);
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
|
|
||||||
import demoTest, { rootPropsTest } from '../../../tests/shared/demoTest';
|
import demoTest, { rootPropsTest } from '../../../tests/shared/demoTest';
|
||||||
|
|
||||||
demoTest('auto-complete', {
|
demoTest('auto-complete', {
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { act } from 'react-dom/test-utils';
|
import { act } from 'react-dom/test-utils';
|
||||||
|
|
||||||
import AutoComplete from '..';
|
import AutoComplete from '..';
|
||||||
import { render } from '../../../tests/utils';
|
import { render } from '../../../tests/utils';
|
||||||
|
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
import userEvent from '@testing-library/user-event';
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import userEvent from '@testing-library/user-event';
|
||||||
|
|
||||||
import AutoComplete from '..';
|
import AutoComplete from '..';
|
||||||
|
import { resetWarned } from '../../_util/warning';
|
||||||
import mountTest from '../../../tests/shared/mountTest';
|
import mountTest from '../../../tests/shared/mountTest';
|
||||||
import rtlTest from '../../../tests/shared/rtlTest';
|
import rtlTest from '../../../tests/shared/rtlTest';
|
||||||
import { render, screen } from '../../../tests/utils';
|
import { render, screen } from '../../../tests/utils';
|
||||||
import { resetWarned } from '../../_util/warning';
|
|
||||||
import Input from '../../input';
|
import Input from '../../input';
|
||||||
|
|
||||||
describe('AutoComplete', () => {
|
describe('AutoComplete', () => {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { AutoComplete, Switch, Space } from 'antd';
|
import { AutoComplete, Space, Switch } from 'antd';
|
||||||
|
|
||||||
const { _InternalPanelDoNotUseOrYouWillBeFired: InternalAutoComplete } = AutoComplete;
|
const { _InternalPanelDoNotUseOrYouWillBeFired: InternalAutoComplete } = AutoComplete;
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
|
|
||||||
import type { ScreenSizeMap } from '../_util/responsiveObserver';
|
import type { ScreenSizeMap } from '../_util/responsiveObserver';
|
||||||
|
|
||||||
export type AvatarSize = 'large' | 'small' | 'default' | number | ScreenSizeMap;
|
export type AvatarSize = 'large' | 'small' | 'default' | number | ScreenSizeMap;
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
import React, { useState } from 'react';
|
import React, { useState } from 'react';
|
||||||
|
|
||||||
import Avatar from '..';
|
import Avatar from '..';
|
||||||
import mountTest from '../../../tests/shared/mountTest';
|
import mountTest from '../../../tests/shared/mountTest';
|
||||||
import rtlTest from '../../../tests/shared/rtlTest';
|
import rtlTest from '../../../tests/shared/rtlTest';
|
||||||
import { fireEvent, render } from '../../../tests/utils';
|
import { fireEvent, render } from '../../../tests/utils';
|
||||||
import useBreakpoint from '../../grid/hooks/useBreakpoint';
|
|
||||||
import ConfigProvider from '../../config-provider';
|
import ConfigProvider from '../../config-provider';
|
||||||
|
import useBreakpoint from '../../grid/hooks/useBreakpoint';
|
||||||
|
|
||||||
jest.mock('../../grid/hooks/useBreakpoint');
|
jest.mock('../../grid/hooks/useBreakpoint');
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
|
|
||||||
import demoTest, { rootPropsTest } from '../../../tests/shared/demoTest';
|
import demoTest, { rootPropsTest } from '../../../tests/shared/demoTest';
|
||||||
|
|
||||||
demoTest('avatar');
|
demoTest('avatar');
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { UserOutlined } from '@ant-design/icons';
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import { UserOutlined } from '@ant-design/icons';
|
||||||
import { Avatar, Badge, Space } from 'antd';
|
import { Avatar, Badge, Space } from 'antd';
|
||||||
|
|
||||||
const App: React.FC = () => (
|
const App: React.FC = () => (
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { UserOutlined } from '@ant-design/icons';
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import { UserOutlined } from '@ant-design/icons';
|
||||||
import { Avatar, Space } from 'antd';
|
import { Avatar, Space } from 'antd';
|
||||||
|
|
||||||
const App: React.FC = () => (
|
const App: React.FC = () => (
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { AntDesignOutlined, UserOutlined } from '@ant-design/icons';
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import { AntDesignOutlined, UserOutlined } from '@ant-design/icons';
|
||||||
import { Avatar, Badge, ConfigProvider, Space, Tooltip } from 'antd';
|
import { Avatar, Badge, ConfigProvider, Space, Tooltip } from 'antd';
|
||||||
|
|
||||||
const App: React.FC = () => (
|
const App: React.FC = () => (
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { AntDesignOutlined, UserOutlined } from '@ant-design/icons';
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import { AntDesignOutlined, UserOutlined } from '@ant-design/icons';
|
||||||
import { Avatar, Divider, Tooltip } from 'antd';
|
import { Avatar, Divider, Tooltip } from 'antd';
|
||||||
|
|
||||||
const App: React.FC = () => (
|
const App: React.FC = () => (
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { UserOutlined } from '@ant-design/icons';
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import { UserOutlined } from '@ant-design/icons';
|
||||||
import { Avatar, Space } from 'antd';
|
import { Avatar, Space } from 'antd';
|
||||||
|
|
||||||
const url = 'https://gw.alipayobjects.com/zos/rmsportal/KDpgvguMpGfqaHPjicRK.svg';
|
const url = 'https://gw.alipayobjects.com/zos/rmsportal/KDpgvguMpGfqaHPjicRK.svg';
|
||||||
|
@ -1,14 +1,15 @@
|
|||||||
|
import * as React from 'react';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import toArray from 'rc-util/lib/Children/toArray';
|
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 { 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 Avatar from './avatar';
|
||||||
import AvatarContext from './AvatarContext';
|
import AvatarContext from './AvatarContext';
|
||||||
import type { AvatarContextType, AvatarSize } from './AvatarContext';
|
import type { AvatarContextType, AvatarSize } from './AvatarContext';
|
||||||
import useStyle from './style';
|
import useStyle from './style';
|
||||||
import useCSSVarCls from '../config-provider/hooks/useCSSVarCls';
|
|
||||||
|
|
||||||
interface ContextProps {
|
interface ContextProps {
|
||||||
children?: React.ReactNode;
|
children?: React.ReactNode;
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import type { ForwardRefExoticComponent, RefAttributes } from 'react';
|
import type { ForwardRefExoticComponent, RefAttributes } from 'react';
|
||||||
|
|
||||||
import type { AvatarProps } from './avatar';
|
import type { AvatarProps } from './avatar';
|
||||||
import InternalAvatar from './avatar';
|
import InternalAvatar from './avatar';
|
||||||
import Group from './group';
|
import Group from './group';
|
||||||
|
@ -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 { resetComponent } from '../../style';
|
||||||
import type { FullToken, GenerateStyle, GetDefaultToken } from '../../theme/internal';
|
import type { FullToken, GenerateStyle, GetDefaultToken } from '../../theme/internal';
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
import BackTop from '..';
|
import BackTop from '..';
|
||||||
import mountTest from '../../../tests/shared/mountTest';
|
import mountTest from '../../../tests/shared/mountTest';
|
||||||
import rtlTest from '../../../tests/shared/rtlTest';
|
import rtlTest from '../../../tests/shared/rtlTest';
|
||||||
|
@ -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 { resetComponent } from '../../style';
|
||||||
import type { FullToken, GenerateStyle, GetDefaultToken } from '../../theme/internal';
|
import type { FullToken, GenerateStyle, GetDefaultToken } from '../../theme/internal';
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import classNames from 'classnames';
|
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
|
import classNames from 'classnames';
|
||||||
|
|
||||||
import { cloneElement } from '../_util/reactNode';
|
import { cloneElement } from '../_util/reactNode';
|
||||||
import { ConfigContext } from '../config-provider';
|
import { ConfigContext } from '../config-provider';
|
||||||
import SingleNumber from './SingleNumber';
|
import SingleNumber from './SingleNumber';
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import classNames from 'classnames';
|
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
|
import classNames from 'classnames';
|
||||||
|
|
||||||
export interface UnitNumberProps {
|
export interface UnitNumberProps {
|
||||||
prefixCls: string;
|
prefixCls: string;
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
|
|
||||||
import demoTest, { rootPropsTest } from '../../../tests/shared/demoTest';
|
import demoTest, { rootPropsTest } from '../../../tests/shared/demoTest';
|
||||||
|
|
||||||
demoTest('badge');
|
demoTest('badge');
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import { fireEvent, render } from '@testing-library/react';
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import { fireEvent, render } from '@testing-library/react';
|
||||||
import { act } from 'react-dom/test-utils';
|
import { act } from 'react-dom/test-utils';
|
||||||
|
|
||||||
import mountTest from '../../../tests/shared/mountTest';
|
import mountTest from '../../../tests/shared/mountTest';
|
||||||
import rtlTest from '../../../tests/shared/rtlTest';
|
import rtlTest from '../../../tests/shared/rtlTest';
|
||||||
import Tooltip from '../../tooltip';
|
import Tooltip from '../../tooltip';
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import { render } from '@testing-library/react';
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import { render } from '@testing-library/react';
|
||||||
|
|
||||||
import mountTest from '../../../tests/shared/mountTest';
|
import mountTest from '../../../tests/shared/mountTest';
|
||||||
import rtlTest from '../../../tests/shared/rtlTest';
|
import rtlTest from '../../../tests/shared/rtlTest';
|
||||||
import Badge from '../index';
|
import Badge from '../index';
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import React, { useState } from 'react';
|
import React, { useState } from 'react';
|
||||||
import { MinusOutlined, PlusOutlined, QuestionOutlined } from '@ant-design/icons';
|
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;
|
const ButtonGroup = Button.Group;
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { NotificationOutlined } from '@ant-design/icons';
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import { NotificationOutlined } from '@ant-design/icons';
|
||||||
import { Avatar, Badge, ConfigProvider, Space } from 'antd';
|
import { Avatar, Badge, ConfigProvider, Space } from 'antd';
|
||||||
|
|
||||||
/** Test usage. Do not use in your production. */
|
/** Test usage. Do not use in your production. */
|
||||||
|
@ -8,7 +8,7 @@ const App: React.FC = () => {
|
|||||||
return (
|
return (
|
||||||
<Space>
|
<Space>
|
||||||
<Switch checked={show} onChange={() => setShow(!show)} />
|
<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 ? 25 : 0} />
|
||||||
<Badge count={show ? <ClockCircleOutlined style={{ color: '#f5222d' }} /> : 0} />
|
<Badge count={show ? <ClockCircleOutlined style={{ color: '#f5222d' }} /> : 0} />
|
||||||
<Badge
|
<Badge
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import { unit } from '@ant-design/cssinjs';
|
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 { resetComponent } from '../../style';
|
||||||
import type { GenerateStyle } from '../../theme/internal';
|
import type { GenerateStyle } from '../../theme/internal';
|
||||||
import { genPresetColor, genStyleHooks } from '../../theme/internal';
|
import { genPresetColor, genStyleHooks } from '../../theme/internal';
|
||||||
|
@ -1,12 +1,13 @@
|
|||||||
import DownOutlined from '@ant-design/icons/DownOutlined';
|
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
|
import DownOutlined from '@ant-design/icons/DownOutlined';
|
||||||
|
|
||||||
|
import { devUseWarning } from '../_util/warning';
|
||||||
import { ConfigContext } from '../config-provider';
|
import { ConfigContext } from '../config-provider';
|
||||||
import type { DropdownProps } from '../dropdown/dropdown';
|
import type { DropdownProps } from '../dropdown/dropdown';
|
||||||
import Dropdown from '../dropdown/dropdown';
|
import Dropdown from '../dropdown/dropdown';
|
||||||
import type { ItemType } from './Breadcrumb';
|
import type { ItemType } from './Breadcrumb';
|
||||||
import BreadcrumbSeparator from './BreadcrumbSeparator';
|
import BreadcrumbSeparator from './BreadcrumbSeparator';
|
||||||
import { renderItem } from './useItemRender';
|
import { renderItem } from './useItemRender';
|
||||||
import { devUseWarning } from '../_util/warning';
|
|
||||||
|
|
||||||
export interface SeparatorType {
|
export interface SeparatorType {
|
||||||
separator?: React.ReactNode;
|
separator?: React.ReactNode;
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
|
|
||||||
import { ConfigContext } from '../config-provider';
|
import { ConfigContext } from '../config-provider';
|
||||||
|
|
||||||
type CompoundedComponent = React.FC<{ children?: React.ReactNode }> & {
|
type CompoundedComponent = React.FC<{ children?: React.ReactNode }> & {
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
|
import { resetWarned } from '../../_util/warning';
|
||||||
import accessibilityTest from '../../../tests/shared/accessibilityTest';
|
import accessibilityTest from '../../../tests/shared/accessibilityTest';
|
||||||
import mountTest from '../../../tests/shared/mountTest';
|
import mountTest from '../../../tests/shared/mountTest';
|
||||||
import rtlTest from '../../../tests/shared/rtlTest';
|
import rtlTest from '../../../tests/shared/rtlTest';
|
||||||
import { render } from '../../../tests/utils';
|
import { render } from '../../../tests/utils';
|
||||||
import { resetWarned } from '../../_util/warning';
|
|
||||||
import type { ItemType } from '../Breadcrumb';
|
import type { ItemType } from '../Breadcrumb';
|
||||||
import Breadcrumb from '../index';
|
import Breadcrumb from '../index';
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
import { render } from '../../../tests/utils';
|
import { render } from '../../../tests/utils';
|
||||||
import Breadcrumb from '../index';
|
import Breadcrumb from '../index';
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import React, { useMemo } from 'react';
|
import React, { useMemo } from 'react';
|
||||||
import type { RouterProps } from 'react-router-dom';
|
import type { RouterProps } from 'react-router-dom';
|
||||||
import { Link, MemoryRouter, Route, Routes, useLocation, useNavigate } from 'react-router-dom';
|
import { Link, MemoryRouter, Route, Routes, useLocation, useNavigate } from 'react-router-dom';
|
||||||
|
|
||||||
import { fireEvent, render } from '../../../tests/utils';
|
import { fireEvent, render } from '../../../tests/utils';
|
||||||
import Breadcrumb from '../index';
|
import Breadcrumb from '../index';
|
||||||
|
|
||||||
@ -51,11 +52,11 @@ describe('react router', () => {
|
|||||||
</Breadcrumb.Item>,
|
</Breadcrumb.Item>,
|
||||||
].concat(extraBreadcrumbItems);
|
].concat(extraBreadcrumbItems);
|
||||||
const componentProps = useMemo<RouterProps>(
|
const componentProps = useMemo<RouterProps>(
|
||||||
() => ({ component: Apps } as unknown as RouterProps),
|
() => ({ component: Apps }) as unknown as RouterProps,
|
||||||
[],
|
[],
|
||||||
);
|
);
|
||||||
const renderProps = useMemo<RouterProps>(
|
const renderProps = useMemo<RouterProps>(
|
||||||
() => ({ render: () => <span>Home Page</span> } as unknown as RouterProps),
|
() => ({ render: () => <span>Home Page</span> }) as unknown as RouterProps,
|
||||||
[],
|
[],
|
||||||
);
|
);
|
||||||
return (
|
return (
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { HomeOutlined, UserOutlined } from '@ant-design/icons';
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import { HomeOutlined, UserOutlined } from '@ant-design/icons';
|
||||||
import { Breadcrumb, ConfigProvider } from 'antd';
|
import { Breadcrumb, ConfigProvider } from 'antd';
|
||||||
|
|
||||||
const menuItems = [
|
const menuItems = [
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { HomeOutlined, UserOutlined } from '@ant-design/icons';
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import { HomeOutlined, UserOutlined } from '@ant-design/icons';
|
||||||
import { Breadcrumb } from 'antd';
|
import { Breadcrumb } from 'antd';
|
||||||
|
|
||||||
const App: React.FC = () => (
|
const App: React.FC = () => (
|
||||||
|
@ -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 { genFocusStyle, resetComponent } from '../../style';
|
||||||
import type { FullToken, GenerateStyle, GetDefaultToken } from '../../theme/internal';
|
import type { FullToken, GenerateStyle, GetDefaultToken } from '../../theme/internal';
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
|
import * as React from 'react';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import pickAttrs from 'rc-util/lib/pickAttrs';
|
import pickAttrs from 'rc-util/lib/pickAttrs';
|
||||||
import * as React from 'react';
|
|
||||||
import type { BreadcrumbProps, InternalRouteType, ItemType } from './Breadcrumb';
|
import type { BreadcrumbProps, InternalRouteType, ItemType } from './Breadcrumb';
|
||||||
|
|
||||||
type AddParameters<TFunction extends (...args: any) => any, TParameters extends [...args: any]> = (
|
type AddParameters<TFunction extends (...args: any) => any, TParameters extends [...args: any]> = (
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { useMemo } from 'react';
|
import { useMemo } from 'react';
|
||||||
|
|
||||||
import type { BreadcrumbItemType, BreadcrumbSeparatorType, ItemType } from './Breadcrumb';
|
import type { BreadcrumbItemType, BreadcrumbSeparatorType, ItemType } from './Breadcrumb';
|
||||||
|
|
||||||
type MergedType = BreadcrumbItemType & {
|
type MergedType = BreadcrumbItemType & {
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
|
import React, { forwardRef } from 'react';
|
||||||
import LoadingOutlined from '@ant-design/icons/LoadingOutlined';
|
import LoadingOutlined from '@ant-design/icons/LoadingOutlined';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import CSSMotion from 'rc-motion';
|
import CSSMotion from 'rc-motion';
|
||||||
import React, { forwardRef } from 'react';
|
|
||||||
import IconWrapper from './IconWrapper';
|
import IconWrapper from './IconWrapper';
|
||||||
|
|
||||||
type InnerLoadingIconProps = {
|
type InnerLoadingIconProps = {
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import React, { useState } from 'react';
|
import React, { useState } from 'react';
|
||||||
import { act } from 'react-dom/test-utils';
|
import { act } from 'react-dom/test-utils';
|
||||||
|
|
||||||
import { fireEvent, render } from '../../../tests/utils';
|
import { fireEvent, render } from '../../../tests/utils';
|
||||||
import Button from '../button';
|
import Button from '../button';
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import userEvent from '@testing-library/user-event';
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import userEvent from '@testing-library/user-event';
|
||||||
|
|
||||||
import Button from '..';
|
import Button from '..';
|
||||||
import { act, fireEvent, render } from '../../../tests/utils';
|
import { act, fireEvent, render } from '../../../tests/utils';
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
import { cloneElement, isFragment } from '../_util/reactNode';
|
import { cloneElement, isFragment } from '../_util/reactNode';
|
||||||
import type { BaseButtonProps, LegacyButtonType } from './button';
|
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;
|
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;
|
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;
|
const ButtonHTMLTypes = ['submit', 'button', 'reset'] as const;
|
||||||
export type ButtonHTMLType = typeof ButtonHTMLTypes[number];
|
export type ButtonHTMLType = (typeof ButtonHTMLTypes)[number];
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { DownloadOutlined } from '@ant-design/icons';
|
import { DownloadOutlined } from '@ant-design/icons';
|
||||||
import { Form, Button } from 'antd';
|
import { Button, Form } from 'antd';
|
||||||
|
|
||||||
const App: React.FC = () => (
|
const App: React.FC = () => (
|
||||||
<Form>
|
<Form>
|
||||||
|
@ -1,14 +1,7 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { SearchOutlined } from '@ant-design/icons';
|
import { SearchOutlined } from '@ant-design/icons';
|
||||||
import {
|
import { Button, ConfigProvider, Divider, Flex, Radio, Tooltip } from 'antd';
|
||||||
Button,
|
import type { ConfigProviderProps } from 'antd';
|
||||||
ConfigProvider,
|
|
||||||
Divider,
|
|
||||||
Flex,
|
|
||||||
Radio,
|
|
||||||
Tooltip,
|
|
||||||
type ConfigProviderProps,
|
|
||||||
} from 'antd';
|
|
||||||
|
|
||||||
type SizeType = ConfigProviderProps['componentSize'];
|
type SizeType = ConfigProviderProps['componentSize'];
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { Button, ConfigProvider, Space } from 'antd';
|
|
||||||
import { TinyColor } from '@ctrl/tinycolor';
|
import { TinyColor } from '@ctrl/tinycolor';
|
||||||
|
import { Button, ConfigProvider, Space } from 'antd';
|
||||||
|
|
||||||
const colors1 = ['#6253E1', '#04BEFE'];
|
const colors1 = ['#6253E1', '#04BEFE'];
|
||||||
const colors2 = ['#fc6076', '#ff9a44', '#ef9d43', '#e75516'];
|
const colors2 = ['#fc6076', '#ff9a44', '#ef9d43', '#e75516'];
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
// Style as inline component
|
// Style as inline component
|
||||||
import type { ButtonToken } from './token';
|
import { unit } from '@ant-design/cssinjs';
|
||||||
import { prepareComponentToken, prepareToken } from './token';
|
|
||||||
import { genCompactItemStyle } from '../../style/compact-item';
|
import { genCompactItemStyle } from '../../style/compact-item';
|
||||||
import { genCompactItemVerticalStyle } from '../../style/compact-item-vertical';
|
import { genCompactItemVerticalStyle } from '../../style/compact-item-vertical';
|
||||||
import type { GenerateStyle } from '../../theme/internal';
|
import type { GenerateStyle } from '../../theme/internal';
|
||||||
import { genSubStyleComponent } 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 genButtonCompactStyle: GenerateStyle<ButtonToken> = (token) => {
|
||||||
const { componentCls, calc } = token;
|
const { componentCls, calc } = token;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import type { ButtonToken } from './token';
|
|
||||||
import type { GenerateStyle } from '../../theme/internal';
|
import type { GenerateStyle } from '../../theme/internal';
|
||||||
|
import type { ButtonToken } from './token';
|
||||||
|
|
||||||
const genButtonBorderStyle = (buttonTypeCls: string, borderColor: string) => ({
|
const genButtonBorderStyle = (buttonTypeCls: string, borderColor: string) => ({
|
||||||
// Border
|
// Border
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import type { CSSProperties } from 'react';
|
import type { CSSProperties } from 'react';
|
||||||
|
|
||||||
import type { FullToken, GetDefaultToken } from '../../theme/internal';
|
import type { FullToken, GetDefaultToken } from '../../theme/internal';
|
||||||
import { getLineHeight, mergeToken } from '../../theme/internal';
|
import { getLineHeight, mergeToken } from '../../theme/internal';
|
||||||
import type { GenStyleFn } from '../../theme/util/genComponentStyleHook';
|
import type { GenStyleFn } from '../../theme/util/genComponentStyleHook';
|
||||||
|
@ -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 * as React from 'react';
|
||||||
import { useContext, useMemo } 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 { FormItemInputContext } from '../form/context';
|
||||||
import { Button, Group } from '../radio';
|
import { Button, Group } from '../radio';
|
||||||
import Select from '../select';
|
import Select from '../select';
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
|
|
||||||
import demoTest from '../../../tests/shared/demoTest';
|
import demoTest from '../../../tests/shared/demoTest';
|
||||||
|
|
||||||
demoTest('calendar', {
|
demoTest('calendar', {
|
||||||
|
@ -4,7 +4,7 @@ import 'dayjs/locale/zh-cn';
|
|||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import MockDate from 'mockdate';
|
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 dayjsGenerateConfig from 'rc-picker/lib/generate/dayjs';
|
||||||
import type { Locale } from 'rc-picker/lib/interface';
|
import type { Locale } from 'rc-picker/lib/interface';
|
||||||
import { resetWarned } from 'rc-util/lib/warning';
|
import { resetWarned } from 'rc-util/lib/warning';
|
||||||
@ -16,7 +16,8 @@ import { fireEvent, render } from '../../../tests/utils';
|
|||||||
import Group from '../../radio/group';
|
import Group from '../../radio/group';
|
||||||
import Button from '../../radio/radioButton';
|
import Button from '../../radio/radioButton';
|
||||||
import Select from '../../select';
|
import Select from '../../select';
|
||||||
import Header, { type CalendarHeaderProps } from '../Header';
|
import Header from '../Header';
|
||||||
|
import type { CalendarHeaderProps } from '../Header';
|
||||||
|
|
||||||
const ref: {
|
const ref: {
|
||||||
calendarProps?: PickerPanelProps;
|
calendarProps?: PickerPanelProps;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import type { Dayjs } from 'dayjs';
|
|
||||||
import { Calendar } from 'antd';
|
import { Calendar } from 'antd';
|
||||||
import type { CalendarProps } from 'antd';
|
import type { CalendarProps } from 'antd';
|
||||||
|
import type { Dayjs } from 'dayjs';
|
||||||
|
|
||||||
const App: React.FC = () => {
|
const App: React.FC = () => {
|
||||||
const onPanelChange = (value: Dayjs, mode: CalendarProps<Dayjs>['mode']) => {
|
const onPanelChange = (value: Dayjs, mode: CalendarProps<Dayjs>['mode']) => {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import type { Dayjs } from 'dayjs';
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { Calendar, theme } from 'antd';
|
import { Calendar, theme } from 'antd';
|
||||||
import type { CalendarProps } from 'antd';
|
import type { CalendarProps } from 'antd';
|
||||||
|
import type { Dayjs } from 'dayjs';
|
||||||
|
|
||||||
const onPanelChange = (value: Dayjs, mode: CalendarProps<Dayjs>['mode']) => {
|
const onPanelChange = (value: Dayjs, mode: CalendarProps<Dayjs>['mode']) => {
|
||||||
console.log(value.format('YYYY-MM-DD'), mode);
|
console.log(value.format('YYYY-MM-DD'), mode);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import type { Dayjs } from 'dayjs';
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { Calendar, ConfigProvider } from 'antd';
|
import { Calendar, ConfigProvider } from 'antd';
|
||||||
import type { CalendarProps } from 'antd';
|
import type { CalendarProps } from 'antd';
|
||||||
|
import type { Dayjs } from 'dayjs';
|
||||||
|
|
||||||
/** Test usage. Do not use in your production. */
|
/** Test usage. Do not use in your production. */
|
||||||
export default () => {
|
export default () => {
|
||||||
|
@ -1,10 +1,12 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
|
|
||||||
import 'dayjs/locale/zh-cn';
|
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 type { Dayjs } from 'dayjs';
|
||||||
import dayLocaleData from 'dayjs/plugin/localeData';
|
import dayLocaleData from 'dayjs/plugin/localeData';
|
||||||
import { Calendar, Col, Radio, Row, Select, Typography, theme } from 'antd';
|
|
||||||
import type { CalendarProps } from 'antd';
|
|
||||||
|
|
||||||
dayjs.extend(dayLocaleData);
|
dayjs.extend(dayLocaleData);
|
||||||
|
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
import dayjs from 'dayjs';
|
|
||||||
import type { Dayjs } from 'dayjs';
|
|
||||||
import React from 'react';
|
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 { Calendar, Col, Radio, Row, Select } from 'antd';
|
||||||
import type { CalendarProps } 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 useStyle = createStyles(({ token, css, cx }) => {
|
||||||
const lunar = css`
|
const lunar = css`
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import type { Dayjs } from 'dayjs';
|
|
||||||
import type { BadgeProps, CalendarProps } from 'antd';
|
import type { BadgeProps, CalendarProps } from 'antd';
|
||||||
import { Badge, Calendar } from 'antd';
|
import { Badge, Calendar } from 'antd';
|
||||||
|
import type { Dayjs } from 'dayjs';
|
||||||
|
|
||||||
const getListData = (value: Dayjs) => {
|
const getListData = (value: Dayjs) => {
|
||||||
let listData;
|
let listData;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import React, { useState } from 'react';
|
import React, { useState } from 'react';
|
||||||
|
import { Alert, Calendar } from 'antd';
|
||||||
import type { Dayjs } from 'dayjs';
|
import type { Dayjs } from 'dayjs';
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
import { Alert, Calendar } from 'antd';
|
|
||||||
|
|
||||||
const App: React.FC = () => {
|
const App: React.FC = () => {
|
||||||
const [value, setValue] = useState(() => dayjs('2017-01-25'));
|
const [value, setValue] = useState(() => dayjs('2017-01-25'));
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import type { Dayjs } from 'dayjs';
|
import type { Dayjs } from 'dayjs';
|
||||||
import dayjsGenerateConfig from 'rc-picker/lib/generate/dayjs';
|
import dayjsGenerateConfig from 'rc-picker/lib/generate/dayjs';
|
||||||
|
|
||||||
import type { CalendarProps } from './generateCalendar';
|
import type { CalendarProps } from './generateCalendar';
|
||||||
import generateCalendar from './generateCalendar';
|
import generateCalendar from './generateCalendar';
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import classNames from 'classnames';
|
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
|
import classNames from 'classnames';
|
||||||
|
|
||||||
import { ConfigContext } from '../config-provider';
|
import { ConfigContext } from '../config-provider';
|
||||||
import type { ConfigConsumerProps } from '../config-provider';
|
import type { ConfigConsumerProps } from '../config-provider';
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import classNames from 'classnames';
|
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
|
import classNames from 'classnames';
|
||||||
|
|
||||||
import type { ConfigConsumerProps } from '../config-provider';
|
import type { ConfigConsumerProps } from '../config-provider';
|
||||||
import { ConfigContext } from '../config-provider';
|
import { ConfigContext } from '../config-provider';
|
||||||
|
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
import '@testing-library/jest-dom';
|
import '@testing-library/jest-dom';
|
||||||
import userEvent from '@testing-library/user-event';
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import userEvent from '@testing-library/user-event';
|
||||||
|
|
||||||
import mountTest from '../../../tests/shared/mountTest';
|
import mountTest from '../../../tests/shared/mountTest';
|
||||||
import rtlTest from '../../../tests/shared/rtlTest';
|
import rtlTest from '../../../tests/shared/rtlTest';
|
||||||
import { render, screen } from '../../../tests/utils';
|
import { render, screen } from '../../../tests/utils';
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
|
|
||||||
import Card from '../index';
|
import Card from '../index';
|
||||||
|
|
||||||
describe('Card.typescript', () => {
|
describe('Card.typescript', () => {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { EditOutlined, EllipsisOutlined, SettingOutlined } from '@ant-design/icons';
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import { EditOutlined, EllipsisOutlined, SettingOutlined } from '@ant-design/icons';
|
||||||
import { Card, ConfigProvider } from 'antd';
|
import { Card, ConfigProvider } from 'antd';
|
||||||
|
|
||||||
export default () => (
|
export default () => (
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user