true} />;
6 |
7 | const componentDemo: ComponentDemo = {
8 | demo: ,
9 | tokens: ['colorBgContainerDisabled', 'colorTextDisabled'],
10 | key: 'disabled',
11 | };
12 |
13 | export default componentDemo;
14 |
--------------------------------------------------------------------------------
/src/previews/components/calendar/index.ts:
--------------------------------------------------------------------------------
1 | import Default from './calendar';
2 | import disabled from './disabled';
3 |
4 | import type { ComponentDemo } from '../../../interface';
5 |
6 | const previewerDemo: ComponentDemo[] = [Default, disabled];
7 |
8 | export default previewerDemo;
9 |
--------------------------------------------------------------------------------
/src/previews/components/card/card.tsx:
--------------------------------------------------------------------------------
1 | import { Card, Space } from 'antd';
2 | import React from 'react';
3 | import type { ComponentDemo } from '../../../interface';
4 |
5 | const Demo = () => (
6 |
7 | More}
10 | style={{ width: 300 }}
11 | >
12 | Card content
Card content
Card content
13 |
14 | More}
19 | style={{ width: 300 }}
20 | >
21 | Card content
Card content
Card content
22 |
23 |
24 | );
25 |
26 | const componentDemo: ComponentDemo = {
27 | demo: ,
28 | tokens: [
29 | 'colorText',
30 | 'colorTextHeading',
31 | 'colorTextSecondary',
32 | 'colorBgContainer',
33 | 'colorBorderSecondary',
34 | 'colorPrimary',
35 | 'colorBgContainer',
36 | ],
37 | key: 'card',
38 | };
39 |
40 | export default componentDemo;
41 |
--------------------------------------------------------------------------------
/src/previews/components/card/cardGrid.tsx:
--------------------------------------------------------------------------------
1 | import { Card } from 'antd';
2 | import type { CSSProperties } from 'react';
3 | import React from 'react';
4 | import type { ComponentDemo } from '../../../interface';
5 |
6 | const gridStyle: CSSProperties = {
7 | width: '25%',
8 | textAlign: 'center',
9 | };
10 |
11 | const Demo = () => (
12 |
13 | Content
14 |
15 | Content
16 |
17 | Content
18 | Content
19 | Content
20 | Content
21 | Content
22 |
23 | );
24 |
25 | const componentDemo: ComponentDemo = {
26 | demo: ,
27 | tokens: ['colorBorderSecondary'],
28 | key: 'cardGrid',
29 | };
30 |
31 | export default componentDemo;
32 |
--------------------------------------------------------------------------------
/src/previews/components/card/index.ts:
--------------------------------------------------------------------------------
1 | import Default from './card';
2 | import cardGrid from './cardGrid';
3 | import inner from './inner';
4 |
5 | import type { ComponentDemo } from '../../../interface';
6 |
7 | const previewerDemo: ComponentDemo[] = [Default, inner, cardGrid];
8 |
9 | export default previewerDemo;
10 |
--------------------------------------------------------------------------------
/src/previews/components/card/inner.tsx:
--------------------------------------------------------------------------------
1 | import { Card, Space } from 'antd';
2 | import React from 'react';
3 | import type { ComponentDemo } from '../../../interface';
4 |
5 | const Demo = () => (
6 |
7 |
8 | Inner Card content
9 |
10 |
11 | );
12 |
13 | const componentDemo: ComponentDemo = {
14 | demo: ,
15 | tokens: ['colorFillAlter'],
16 | key: 'inner',
17 | };
18 |
19 | export default componentDemo;
20 |
--------------------------------------------------------------------------------
/src/previews/components/carousel/carousel.tsx:
--------------------------------------------------------------------------------
1 | import { Carousel } from 'antd';
2 | import type { CSSProperties } from 'react';
3 | import React from 'react';
4 |
5 | import type { ComponentDemo } from '../../../interface';
6 |
7 | const contentStyle = {
8 | height: '160px',
9 | color: '#fff',
10 | lineHeight: '160px',
11 | textAlign: 'center',
12 | background: '#364d79',
13 | };
14 | const Demo = () => (
15 |
16 |
17 |
1
18 |
19 |
20 |
2
21 |
22 |
23 |
3
24 |
25 |
26 |
4
27 |
28 |
29 | );
30 |
31 | const componentDemo: ComponentDemo = {
32 | demo: ,
33 | tokens: ['colorText', 'colorBgContainer'],
34 | key: 'default',
35 | };
36 |
37 | export default componentDemo;
38 |
--------------------------------------------------------------------------------
/src/previews/components/carousel/index.ts:
--------------------------------------------------------------------------------
1 | import Default from './carousel';
2 |
3 | import type { ComponentDemo } from '../../../interface';
4 |
5 | const previewerDemo: ComponentDemo[] = [Default];
6 |
7 | export default previewerDemo;
8 |
--------------------------------------------------------------------------------
/src/previews/components/cascader/cascader.tsx:
--------------------------------------------------------------------------------
1 | import { Cascader } from 'antd';
2 | import React from 'react';
3 |
4 | import type { ComponentDemo } from '../../../interface';
5 | import options from './data';
6 | const { _InternalPanelDoNotUseOrYouWillBeFired: InternalCascader } = Cascader;
7 |
8 | const Demo = (props: any) => (
9 |
15 | );
16 |
17 | const componentDemo: ComponentDemo = {
18 | demo: ,
19 | tokens: ['colorBgContainer', 'colorPrimary'],
20 | key: 'default',
21 | };
22 |
23 | export default componentDemo;
24 |
--------------------------------------------------------------------------------
/src/previews/components/cascader/data.ts:
--------------------------------------------------------------------------------
1 | const options = [
2 | {
3 | value: 'zhejiang',
4 | label: 'Zhejiang',
5 | children: [
6 | {
7 | value: 'hangzhou',
8 | label: 'Hangzhou',
9 | children: [{ value: 'xihu', label: 'West Lake' }],
10 | },
11 | ],
12 | },
13 | {
14 | value: 'jiangsu',
15 | label: 'Jiangsu',
16 | children: [
17 | {
18 | value: 'nanjing',
19 | label: 'Nanjing',
20 | children: [{ value: 'zhonghuamen', label: 'Zhong Hua Men' }],
21 | },
22 | ],
23 | },
24 | ];
25 |
26 | export default options;
27 |
--------------------------------------------------------------------------------
/src/previews/components/cascader/disable.tsx:
--------------------------------------------------------------------------------
1 | import { Cascader } from 'antd';
2 | import React from 'react';
3 |
4 | import type { ComponentDemo } from '../../../interface';
5 | import options from './data';
6 |
7 | const { _InternalPanelDoNotUseOrYouWillBeFired: InternalCascader } = Cascader;
8 |
9 | const Demo = () => (
10 |
16 | );
17 |
18 | const componentDemo: ComponentDemo = {
19 | demo: ,
20 | tokens: ['colorBgContainerDisabled'],
21 | key: 'disabled',
22 | };
23 |
24 | export default componentDemo;
25 |
--------------------------------------------------------------------------------
/src/previews/components/cascader/highlight.tsx:
--------------------------------------------------------------------------------
1 | import { Cascader as _Cascader } from 'antd';
2 | import React from 'react';
3 | import type { ComponentDemo } from '../../../interface';
4 |
5 | import options from './data';
6 |
7 | const { _InternalPanelDoNotUseOrYouWillBeFired: Cascader } = _Cascader;
8 |
9 | const Demo = () => {
10 | return (
11 |
17 | );
18 | };
19 |
20 | const componentDemo: ComponentDemo = {
21 | demo: ,
22 | tokens: ['colorHighlight'],
23 | key: 'highlight',
24 | };
25 |
26 | export default componentDemo;
27 |
--------------------------------------------------------------------------------
/src/previews/components/cascader/index.ts:
--------------------------------------------------------------------------------
1 | import Default from './cascader';
2 | import disable from './disable';
3 | import HighLight from './highlight';
4 |
5 | import type { ComponentDemo } from '../../../interface';
6 |
7 | const previewerDemo: ComponentDemo[] = [Default, HighLight, disable];
8 |
9 | export default previewerDemo;
10 |
--------------------------------------------------------------------------------
/src/previews/components/checkbox/checkbox.tsx:
--------------------------------------------------------------------------------
1 | import { Checkbox, Space } from 'antd';
2 | import React from 'react';
3 | import type { ComponentDemo } from '../../../interface';
4 |
5 | const Demo = (props: any) => (
6 |
7 | Checkbox
8 |
9 | 选中态
10 |
11 |
12 | );
13 |
14 | const componentDemo: ComponentDemo = {
15 | demo: ,
16 | tokens: ['colorPrimary', 'colorText', 'colorBgContainer'],
17 | key: 'default',
18 | };
19 |
20 | export default componentDemo;
21 |
--------------------------------------------------------------------------------
/src/previews/components/checkbox/disabled.tsx:
--------------------------------------------------------------------------------
1 | import { Checkbox } from 'antd';
2 | import React from 'react';
3 | import type { ComponentDemo } from '../../../interface';
4 |
5 | const Demo = () => Checkbox ;
6 |
7 | const componentDemo: ComponentDemo = {
8 | demo: ,
9 | tokens: ['colorTextDisabled', 'colorBgContainerDisabled'],
10 | key: 'disabled',
11 | };
12 |
13 | export default componentDemo;
14 |
--------------------------------------------------------------------------------
/src/previews/components/checkbox/index.ts:
--------------------------------------------------------------------------------
1 | import Default from './checkbox';
2 | import disabled from './disabled';
3 |
4 | import type { ComponentDemo } from '../../../interface';
5 |
6 | const previewerDemo: ComponentDemo[] = [Default, disabled];
7 |
8 | export default previewerDemo;
9 |
--------------------------------------------------------------------------------
/src/previews/components/collapse/collapse.tsx:
--------------------------------------------------------------------------------
1 | import { Collapse } from 'antd';
2 | import React from 'react';
3 | import type { ComponentDemo } from '../../../interface';
4 |
5 | const { Panel } = Collapse;
6 | const text = ` A dog is a type of domesticated animal. Known for its loyalty and faithfulness, it can be found as a welcome guest in many households across the world.`;
7 |
8 | const Demo = () => (
9 |
10 |
11 | {text}
12 |
13 |
14 | {text}
15 |
16 |
17 | {text}
18 |
19 |
20 | );
21 |
22 | const componentDemo: ComponentDemo = {
23 | demo: ,
24 | tokens: [
25 | 'colorTextSecondary',
26 | 'colorText',
27 | 'colorFillAlter',
28 | 'colorBgContainer',
29 | ],
30 | key: 'default',
31 | };
32 |
33 | export default componentDemo;
34 |
--------------------------------------------------------------------------------
/src/previews/components/collapse/index.ts:
--------------------------------------------------------------------------------
1 | import Default from './collapse';
2 |
3 | import type { ComponentDemo } from '../../../interface';
4 |
5 | const previewerDemo: ComponentDemo[] = [Default];
6 |
7 | export default previewerDemo;
8 |
--------------------------------------------------------------------------------
/src/previews/components/datePicker/danger.tsx:
--------------------------------------------------------------------------------
1 | import { DatePicker } from 'antd';
2 | import React from 'react';
3 | import type { ComponentDemo } from '../../../interface';
4 |
5 | const Demo = () => ;
6 |
7 | const componentDemo: ComponentDemo = {
8 | demo: ,
9 | tokens: [
10 | 'colorError',
11 | 'colorErrorBorder',
12 | 'colorErrorHover',
13 | 'colorErrorOutline',
14 | ],
15 | key: 'danger',
16 | };
17 |
18 | export default componentDemo;
19 |
--------------------------------------------------------------------------------
/src/previews/components/datePicker/date-picker.tsx:
--------------------------------------------------------------------------------
1 | import { DatePicker, Space } from 'antd';
2 | import React from 'react';
3 | import type { ComponentDemo } from '../../../interface';
4 |
5 | const Demo = () => (
6 |
7 |
8 |
9 |
10 |
11 |
12 | );
13 |
14 | const componentDemo: ComponentDemo = {
15 | demo: ,
16 | tokens: [
17 | 'colorPrimary',
18 | 'colorPrimaryBorder',
19 | 'colorPrimaryHover',
20 | 'controlOutline',
21 | 'colorBgElevated',
22 | 'colorBgContainer',
23 | ],
24 | key: 'default',
25 | };
26 |
27 | export default componentDemo;
28 |
--------------------------------------------------------------------------------
/src/previews/components/datePicker/disabled.tsx:
--------------------------------------------------------------------------------
1 | import { DatePicker, Space } from 'antd';
2 | import React from 'react';
3 | import type { ComponentDemo } from '../../../interface';
4 |
5 | const Demo = () => (
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 | );
14 |
15 | const componentDemo: ComponentDemo = {
16 | demo: ,
17 | tokens: ['colorBgContainerDisabled', 'colorTextDisabled'],
18 | key: 'disabled',
19 | };
20 |
21 | export default componentDemo;
22 |
--------------------------------------------------------------------------------
/src/previews/components/datePicker/icon.tsx:
--------------------------------------------------------------------------------
1 | import { DatePicker } from 'antd';
2 | import React from 'react';
3 | import type { ComponentDemo } from '../../../interface';
4 |
5 | const Demo = () => ;
6 |
7 | const componentDemo: ComponentDemo = {
8 | demo: ,
9 | tokens: ['colorIcon', 'colorIconHover'],
10 | key: 'icon',
11 | };
12 |
13 | export default componentDemo;
14 |
--------------------------------------------------------------------------------
/src/previews/components/datePicker/index.ts:
--------------------------------------------------------------------------------
1 | import danger from './danger';
2 | import Default from './date-picker';
3 | import disabled from './disabled';
4 | import icon from './icon';
5 | import warning from './warning';
6 |
7 | import type { ComponentDemo } from '../../../interface';
8 |
9 | const previewerDemo: ComponentDemo[] = [
10 | Default,
11 | danger,
12 | warning,
13 | icon,
14 | disabled,
15 | ];
16 |
17 | export default previewerDemo;
18 |
--------------------------------------------------------------------------------
/src/previews/components/datePicker/warning.tsx:
--------------------------------------------------------------------------------
1 | import { DatePicker } from 'antd';
2 | import React from 'react';
3 | import type { ComponentDemo } from '../../../interface';
4 |
5 | const Demo = () => ;
6 |
7 | const componentDemo: ComponentDemo = {
8 | demo: ,
9 | tokens: [
10 | 'colorWarning',
11 | 'colorWarningBorder',
12 | 'colorWarningHover',
13 | 'colorWarningOutline',
14 | ],
15 | key: 'warning',
16 | };
17 |
18 | export default componentDemo;
19 |
--------------------------------------------------------------------------------
/src/previews/components/descriptions/descriptions.tsx:
--------------------------------------------------------------------------------
1 | import { Descriptions } from 'antd';
2 | import React from 'react';
3 | import type { ComponentDemo } from '../../../interface';
4 |
5 | const Demo = () => (
6 |
7 | Cloud Database
8 | Prepaid
9 | YES
10 |
11 | 2018-04-24 18:00:00
12 |
13 |
14 | );
15 |
16 | const componentDemo: ComponentDemo = {
17 | demo: ,
18 | tokens: ['colorSplit', 'colorText', 'colorFillAlter'],
19 | key: 'default',
20 | };
21 |
22 | export default componentDemo;
23 |
--------------------------------------------------------------------------------
/src/previews/components/descriptions/index.ts:
--------------------------------------------------------------------------------
1 | import Default from './descriptions';
2 |
3 | import type { ComponentDemo } from '../../../interface';
4 |
5 | const previewerDemo: ComponentDemo[] = [Default];
6 |
7 | export default previewerDemo;
8 |
--------------------------------------------------------------------------------
/src/previews/components/divider/divider.tsx:
--------------------------------------------------------------------------------
1 | import { Divider } from 'antd';
2 | import React from 'react';
3 |
4 | import type { ComponentDemo } from '../../../interface';
5 |
6 | const Demo = () => (
7 | <>
8 |
9 | Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed nonne
10 | merninisti licere mihi ista probare, quae sunt a te dicta? Refert tamen,
11 | quo modo.
12 |
13 | Text
14 |
15 | Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed nonne
16 | merninisti licere mihi ista probare, quae sunt a te dicta? Refert tamen,
17 | quo modo.
18 |
19 |
20 | Left Text
21 |
22 |
23 | Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed nonne
24 | merninisti licere mihi ista probare, quae sunt a te dicta? Refert tamen,
25 | quo modo.
26 |
27 |
28 | Right Text
29 |
30 |
31 | Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed nonne
32 | merninisti licere mihi ista probare, quae sunt a te dicta? Refert tamen,
33 | quo modo.
34 |
35 | >
36 | );
37 |
38 | const componentDemo: ComponentDemo = {
39 | demo: ,
40 | tokens: ['colorSplit', 'colorText'],
41 | key: 'divider',
42 | };
43 |
44 | export default componentDemo;
45 |
--------------------------------------------------------------------------------
/src/previews/components/divider/index.ts:
--------------------------------------------------------------------------------
1 | import Default from './divider';
2 |
3 | import type { ComponentDemo } from '../../../interface';
4 |
5 | const previewerDemo: ComponentDemo[] = [Default];
6 |
7 | export default previewerDemo;
8 |
--------------------------------------------------------------------------------
/src/previews/components/drawer/drawer.tsx:
--------------------------------------------------------------------------------
1 | import { Button, Drawer } from 'antd';
2 | import React, { useState } from 'react';
3 | import type { ComponentDemo } from '../../../interface';
4 |
5 | const Demo: React.FC = () => {
6 | const [visible, setVisible] = useState(false);
7 |
8 | const showDrawer = () => {
9 | setVisible(true);
10 | };
11 |
12 | const onClose = () => {
13 | setVisible(false);
14 | };
15 |
16 | return (
17 | <>
18 |
19 | Open
20 |
21 |
27 | Some contents...
28 | Some contents...
29 | Some contents...
30 |
31 | >
32 | );
33 | };
34 |
35 | const componentDemo: ComponentDemo = {
36 | demo: ,
37 | tokens: ['colorBgMask', 'colorBgElevated'],
38 | key: 'default',
39 | };
40 |
41 | export default componentDemo;
42 |
--------------------------------------------------------------------------------
/src/previews/components/drawer/index.ts:
--------------------------------------------------------------------------------
1 | import Default from './drawer';
2 |
3 | import type { ComponentDemo } from '../../../interface';
4 |
5 | const previewerDemo: ComponentDemo[] = [Default];
6 |
7 | export default previewerDemo;
8 |
--------------------------------------------------------------------------------
/src/previews/components/dropdown/dropdown.tsx:
--------------------------------------------------------------------------------
1 | import { DownOutlined } from '@ant-design/icons';
2 | import { Dropdown } from 'antd';
3 | import React from 'react';
4 |
5 | import menu from './menu';
6 |
7 | import type { ComponentDemo } from '../../../interface';
8 |
9 | const Demo = () => (
10 |
16 | );
17 |
18 | const componentDemo: ComponentDemo = {
19 | demo: ,
20 | tokens: ['colorPrimary', 'colorError', 'colorErrorHover', 'colorBgElevated'],
21 | key: 'default',
22 | };
23 |
24 | export default componentDemo;
25 |
--------------------------------------------------------------------------------
/src/previews/components/dropdown/dropdownError.tsx:
--------------------------------------------------------------------------------
1 | import { DownOutlined } from '@ant-design/icons';
2 | import { Dropdown, Typography } from 'antd';
3 | import React from 'react';
4 |
5 | import type { ComponentDemo } from '../../../interface';
6 |
7 | const Demo = () => (
8 |
9 | e.preventDefault()}>
10 | Hover me
11 |
12 |
33 |
34 | );
35 |
36 | const componentDemo: ComponentDemo = {
37 | demo: ,
38 | tokens: ['colorError', 'colorErrorHover', 'colorBgElevated'],
39 | key: 'default',
40 | };
41 |
42 | export default componentDemo;
43 |
--------------------------------------------------------------------------------
/src/previews/components/dropdown/index.ts:
--------------------------------------------------------------------------------
1 | import Default from './dropdown';
2 |
3 | import type { ComponentDemo } from '../../../interface';
4 |
5 | const previewerDemo: ComponentDemo[] = [Default];
6 |
7 | export default previewerDemo;
8 |
--------------------------------------------------------------------------------
/src/previews/components/dropdown/menu.tsx:
--------------------------------------------------------------------------------
1 | import { DownOutlined } from '@ant-design/icons';
2 | import { Menu } from 'antd';
3 | import React from 'react';
4 |
5 | const menu = (
6 |
7 |
8 |
13 | 1st menu item
14 |
15 |
16 | } disabled>
17 |
22 | 2nd menu item (disabled)
23 |
24 |
25 |
26 |
31 | 3rd menu item (disabled)
32 |
33 |
34 | a danger item
35 |
36 | );
37 |
38 | export default menu;
39 |
--------------------------------------------------------------------------------
/src/previews/components/empty/empty.tsx:
--------------------------------------------------------------------------------
1 | import { Empty } from 'antd';
2 | import React from 'react';
3 | import type { ComponentDemo } from '../../../interface';
4 |
5 | const Demo = () => ;
6 |
7 | const componentDemo: ComponentDemo = {
8 | demo: ,
9 | tokens: ['colorTextDisabled'],
10 | key: 'default',
11 | };
12 |
13 | export default componentDemo;
14 |
--------------------------------------------------------------------------------
/src/previews/components/empty/index.ts:
--------------------------------------------------------------------------------
1 | import Default from './empty';
2 |
3 | import type { ComponentDemo } from '../../../interface';
4 |
5 | const previewerDemo: ComponentDemo[] = [Default];
6 |
7 | export default previewerDemo;
8 |
--------------------------------------------------------------------------------
/src/previews/components/form/danger.tsx:
--------------------------------------------------------------------------------
1 | import { Form, Input } from 'antd';
2 | import React from 'react';
3 | import type { ComponentDemo } from '../../../interface';
4 |
5 | function onFinish() {}
6 |
7 | const Demo = () => (
8 |
22 |
23 |
24 |
25 | );
26 |
27 | const componentDemo: ComponentDemo = {
28 | demo: ,
29 | tokens: ['colorError', 'colorErrorBorder', 'colorErrorHover'],
30 | key: 'danger',
31 | };
32 |
33 | export default componentDemo;
34 |
--------------------------------------------------------------------------------
/src/previews/components/form/form.tsx:
--------------------------------------------------------------------------------
1 | import { Button, Checkbox, Form, Input } from 'antd';
2 | import React from 'react';
3 | import type { ComponentDemo } from '../../../interface';
4 |
5 | const Demo = () => {
6 | const onFinish = () => {};
7 | const onFinishFailed = () => {};
8 | return (
9 |
23 |
24 |
25 |
30 |
31 |
32 |
37 | Remember me
38 |
39 |
40 |
41 | Submit
42 |
43 |
44 |
45 | );
46 | };
47 |
48 | const componentDemo: ComponentDemo = {
49 | demo: ,
50 | tokens: [
51 | 'colorError',
52 | 'controlOutline',
53 | 'colorErrorBorder',
54 | 'colorErrorHover',
55 | ],
56 | key: 'default',
57 | };
58 |
59 | export default componentDemo;
60 |
--------------------------------------------------------------------------------
/src/previews/components/form/index.tsx:
--------------------------------------------------------------------------------
1 | import Default from './form';
2 |
3 | import danger from './danger';
4 | import warning from './warning';
5 |
6 | import type { ComponentDemo } from '../../../interface';
7 |
8 | const previewerDemo: ComponentDemo[] = [Default, warning, danger];
9 |
10 | export default previewerDemo;
11 |
--------------------------------------------------------------------------------
/src/previews/components/form/warning.tsx:
--------------------------------------------------------------------------------
1 | import { Form, Input } from 'antd';
2 | import React from 'react';
3 | import type { ComponentDemo } from '../../../interface';
4 |
5 | function onFinish() {}
6 |
7 | const Demo = () => (
8 |
22 |
23 |
24 |
25 | );
26 |
27 | const componentDemo: ComponentDemo = {
28 | demo: ,
29 | tokens: ['colorWarning'],
30 | key: 'warning',
31 | };
32 |
33 | export default componentDemo;
34 |
--------------------------------------------------------------------------------
/src/previews/components/grid/grid.tsx:
--------------------------------------------------------------------------------
1 | import { Col, Row } from 'antd';
2 | import classNames from 'classnames';
3 | import React from 'react';
4 | import type { ComponentDemo } from '../../../interface';
5 | import makeStyle from '../../../utils/makeStyle';
6 |
7 | const useStyle = makeStyle('GridDemo', (token) => ({
8 | '.previewer-grid-demo': {
9 | [`${token.rootCls}-row`]: {
10 | marginBottom: 16,
11 | },
12 | [`${token.rootCls}-row > div:not(.gutter-row)`]: {
13 | padding: '16px 0',
14 | background: '#0092ff',
15 | color: '#fff',
16 | display: 'inline-flex',
17 | alignItems: 'center',
18 | justifyContent: 'center',
19 |
20 | '&:nth-child(2n + 1)': {
21 | background: 'rgba(0,146,255,.75)',
22 | },
23 | },
24 | },
25 | }));
26 |
27 | const Demo = () => {
28 | const [, hashId] = useStyle();
29 |
30 | return (
31 |
32 |
33 | col
34 |
35 |
36 | col-12 col-12
37 |
38 |
39 | col-8 col-8
40 | col-8
41 |
42 |
43 | col-6 col-6
44 | col-6
45 | col-6
46 |
47 |
48 | );
49 | };
50 |
51 | const componentDemo: ComponentDemo = {
52 | demo: ,
53 | key: 'default',
54 | };
55 |
56 | export default componentDemo;
57 |
--------------------------------------------------------------------------------
/src/previews/components/grid/index.ts:
--------------------------------------------------------------------------------
1 | import Default from './grid';
2 |
3 | import type { ComponentDemo } from '../../../interface';
4 |
5 | const previewerDemo: ComponentDemo[] = [Default];
6 |
7 | export default previewerDemo;
8 |
--------------------------------------------------------------------------------
/src/previews/components/icon/icon.tsx:
--------------------------------------------------------------------------------
1 | import {
2 | HomeOutlined,
3 | LoadingOutlined,
4 | SettingFilled,
5 | SmileOutlined,
6 | SyncOutlined,
7 | } from '@ant-design/icons';
8 | import { Space } from 'antd';
9 | import React from 'react';
10 | import type { ComponentDemo } from '../../../interface';
11 |
12 | const Demo = () => (
13 |
14 |
15 |
16 |
17 | );
18 |
19 | const componentDemo: ComponentDemo = {
20 | demo: ,
21 | key: 'default',
22 | };
23 |
24 | export default componentDemo;
25 |
--------------------------------------------------------------------------------
/src/previews/components/icon/index.ts:
--------------------------------------------------------------------------------
1 | import Default from './icon';
2 |
3 | import type { ComponentDemo } from '../../../interface';
4 |
5 | const previewerDemo: ComponentDemo[] = [Default];
6 |
7 | export default previewerDemo;
8 |
--------------------------------------------------------------------------------
/src/previews/components/image/disabled.tsx:
--------------------------------------------------------------------------------
1 | import { Image } from 'antd';
2 | import React from 'react';
3 |
4 | import type { ComponentDemo } from '../../../interface';
5 |
6 | const Demo = () => {
7 | return ;
8 | };
9 |
10 | const componentDemo: ComponentDemo = {
11 | demo: ,
12 | tokens: ['colorBgContainerDisabled'],
13 | key: 'disabled',
14 | };
15 |
16 | export default componentDemo;
17 |
--------------------------------------------------------------------------------
/src/previews/components/image/image.tsx:
--------------------------------------------------------------------------------
1 | import { Image } from 'antd';
2 | import React from 'react';
3 |
4 | import type { ComponentDemo } from '../../../interface';
5 |
6 | const Demo = () => {
7 | return (
8 |
12 | );
13 | };
14 |
15 | const componentDemo: ComponentDemo = {
16 | demo: ,
17 | tokens: ['colorBgMask'],
18 | key: 'default',
19 | };
20 |
21 | export default componentDemo;
22 |
--------------------------------------------------------------------------------
/src/previews/components/image/index.ts:
--------------------------------------------------------------------------------
1 | import disabled from './disabled';
2 | import Default from './image';
3 |
4 | import type { ComponentDemo } from '../../../interface';
5 |
6 | const previewerDemo: ComponentDemo[] = [Default, disabled];
7 |
8 | export default previewerDemo;
9 |
--------------------------------------------------------------------------------
/src/previews/components/input/clearIcon.tsx:
--------------------------------------------------------------------------------
1 | import { Input } from 'antd';
2 | import React from 'react';
3 |
4 | import type { ComponentDemo } from '../../../interface';
5 |
6 | const Demo = () => (
7 |
12 | );
13 |
14 | const componentDemo: ComponentDemo = {
15 | demo: ,
16 | tokens: ['colorIcon', 'colorIconHover'],
17 | key: 'clearIcon',
18 | };
19 | export default componentDemo;
20 |
--------------------------------------------------------------------------------
/src/previews/components/input/danger.tsx:
--------------------------------------------------------------------------------
1 | import { Input } from 'antd';
2 | import React from 'react';
3 | import type { ComponentDemo } from '../../../interface';
4 |
5 | function onChange() {}
6 |
7 | const Demo = () => (
8 |
9 | );
10 |
11 | const componentDemo: ComponentDemo = {
12 | demo: ,
13 | tokens: [
14 | 'colorError',
15 | 'colorErrorOutline',
16 | 'colorErrorBorder',
17 | 'colorErrorHover',
18 | ],
19 | key: 'danger',
20 | };
21 |
22 | export default componentDemo;
23 |
--------------------------------------------------------------------------------
/src/previews/components/input/disabled.tsx:
--------------------------------------------------------------------------------
1 | import { Input } from 'antd';
2 | import React from 'react';
3 | import type { ComponentDemo } from '../../../interface';
4 |
5 | const Demo = () => ;
6 |
7 | const componentDemo: ComponentDemo = {
8 | demo: ,
9 | tokens: ['colorBgContainerDisabled'],
10 | key: 'disabled',
11 | };
12 |
13 | export default componentDemo;
14 |
--------------------------------------------------------------------------------
/src/previews/components/input/index.ts:
--------------------------------------------------------------------------------
1 | import clearIcon from './clearIcon';
2 | import danger from './danger';
3 | import disabled from './disabled';
4 | import Default from './input';
5 | import warning from './warning';
6 | import withAddon from './withAddon';
7 |
8 | import type { ComponentDemo } from '../../../interface';
9 |
10 | const previewerDemo: ComponentDemo[] = [
11 | Default,
12 | clearIcon,
13 | danger,
14 | warning,
15 | withAddon,
16 | disabled,
17 | ];
18 |
19 | export default previewerDemo;
20 |
--------------------------------------------------------------------------------
/src/previews/components/input/input.tsx:
--------------------------------------------------------------------------------
1 | import { Input } from 'antd';
2 | import React from 'react';
3 | import type { ComponentDemo } from '../../../interface';
4 |
5 | const Demo = () => ;
6 |
7 | const componentDemo: ComponentDemo = {
8 | demo: ,
9 | tokens: [
10 | 'colorPrimary',
11 | 'colorPrimaryHover',
12 | 'controlOutline',
13 | 'colorBgContainer',
14 | ],
15 | key: 'default',
16 | };
17 |
18 | export default componentDemo;
19 |
--------------------------------------------------------------------------------
/src/previews/components/input/success.tsx:
--------------------------------------------------------------------------------
1 | import { CheckCircleFilled } from '@ant-design/icons';
2 | import { Input, theme } from 'antd';
3 | import React from 'react';
4 | import type { ComponentDemo } from '../../../interface';
5 |
6 | function onChange() {}
7 |
8 | const Demo = () => {
9 | const { token } = theme.useToken();
10 | return (
11 | }
14 | onChange={onChange}
15 | />
16 | );
17 | };
18 |
19 | const componentDemo: ComponentDemo = {
20 | demo: ,
21 | tokens: ['colorSuccess'],
22 | key: 'warning',
23 | };
24 |
25 | export default componentDemo;
26 |
--------------------------------------------------------------------------------
/src/previews/components/input/warning.tsx:
--------------------------------------------------------------------------------
1 | import { Input } from 'antd';
2 | import React from 'react';
3 | import type { ComponentDemo } from '../../../interface';
4 |
5 | function onChange() {}
6 |
7 | const Demo = () => (
8 |
9 | );
10 |
11 | const componentDemo: ComponentDemo = {
12 | demo: ,
13 | tokens: [
14 | 'colorWarning',
15 | 'colorWarningBorder',
16 | 'colorWarningHover',
17 | 'colorWarningOutline',
18 | ],
19 | key: 'warning',
20 | };
21 |
22 | export default componentDemo;
23 |
--------------------------------------------------------------------------------
/src/previews/components/input/withAddon.tsx:
--------------------------------------------------------------------------------
1 | import { Input } from 'antd';
2 | import React from 'react';
3 | import type { ComponentDemo } from '../../../interface';
4 |
5 | const Demo = () => (
6 |
7 | );
8 |
9 | const componentDemo: ComponentDemo = {
10 | demo: ,
11 | tokens: ['colorFillAlter'],
12 | key: 'withAddon',
13 | };
14 |
15 | export default componentDemo;
16 |
--------------------------------------------------------------------------------
/src/previews/components/inputNumber/danger.tsx:
--------------------------------------------------------------------------------
1 | import { InputNumber } from 'antd';
2 | import React from 'react';
3 | import type { ComponentDemo } from '../../../interface';
4 |
5 | function onChange() {}
6 |
7 | const Demo = () => (
8 |
15 | );
16 |
17 | const componentDemo: ComponentDemo = {
18 | demo: ,
19 | tokens: [
20 | 'colorErrorBorder',
21 | 'colorErrorOutline',
22 | 'colorErrorHover',
23 | 'colorError',
24 | ],
25 | key: 'danger',
26 | };
27 |
28 | export default componentDemo;
29 |
--------------------------------------------------------------------------------
/src/previews/components/inputNumber/disabled.tsx:
--------------------------------------------------------------------------------
1 | import { InputNumber } from 'antd';
2 | import React from 'react';
3 |
4 | import type { ComponentDemo } from '../../../interface';
5 |
6 | const Demo = () => ;
7 | const componentDemo: ComponentDemo = {
8 | demo: ,
9 | tokens: ['colorBgContainerDisabled'],
10 | key: 'disabled',
11 | };
12 |
13 | export default componentDemo;
14 |
--------------------------------------------------------------------------------
/src/previews/components/inputNumber/index.ts:
--------------------------------------------------------------------------------
1 | import danger from './danger';
2 | import disabled from './disabled';
3 | import Default from './inputNumber';
4 | import warning from './warning';
5 |
6 | import type { ComponentDemo } from '../../../interface';
7 |
8 | const previewerDemo: ComponentDemo[] = [Default, danger, warning, disabled];
9 |
10 | export default previewerDemo;
11 |
--------------------------------------------------------------------------------
/src/previews/components/inputNumber/inputNumber.tsx:
--------------------------------------------------------------------------------
1 | import { InputNumber } from 'antd';
2 | import React from 'react';
3 | import type { ComponentDemo } from '../../../interface';
4 |
5 | function onChange() {}
6 | const Demo = () => (
7 |
8 | );
9 |
10 | const componentDemo: ComponentDemo = {
11 | demo: ,
12 | tokens: [
13 | 'colorPrimaryBorder',
14 | 'controlOutline',
15 | 'colorPrimaryHover',
16 | 'colorPrimary',
17 | 'colorBgContainer',
18 | ],
19 | key: 'default',
20 | };
21 |
22 | export default componentDemo;
23 |
--------------------------------------------------------------------------------
/src/previews/components/inputNumber/warning.tsx:
--------------------------------------------------------------------------------
1 | import { InputNumber } from 'antd';
2 | import React from 'react';
3 | import type { ComponentDemo } from '../../../interface';
4 |
5 | function onChange() {}
6 |
7 | const Demo = () => (
8 |
15 | );
16 |
17 | const componentDemo: ComponentDemo = {
18 | demo: ,
19 | tokens: [
20 | 'colorWarning',
21 | 'colorWarningBorder',
22 | 'colorWarningOutline',
23 | 'colorWarningHover',
24 | ],
25 | key: 'warning',
26 | };
27 |
28 | export default componentDemo;
29 |
--------------------------------------------------------------------------------
/src/previews/components/layout/index.ts:
--------------------------------------------------------------------------------
1 | import topSide2 from './top-side-2';
2 |
3 | import type { ComponentDemo } from '../../../interface';
4 |
5 | const previewerDemo: ComponentDemo[] = [topSide2];
6 |
7 | export default previewerDemo;
8 |
--------------------------------------------------------------------------------
/src/previews/components/list/index.ts:
--------------------------------------------------------------------------------
1 | import Default from './list';
2 |
3 | import type { ComponentDemo } from '../../../interface';
4 |
5 | const previewerDemo: ComponentDemo[] = [Default];
6 |
7 | export default previewerDemo;
8 |
--------------------------------------------------------------------------------
/src/previews/components/list/list.tsx:
--------------------------------------------------------------------------------
1 | import { Avatar, List } from 'antd';
2 | import React from 'react';
3 | import type { ComponentDemo } from '../../../interface';
4 |
5 | const data = [
6 | { title: 'Ant Design Title 1' },
7 | { title: 'Ant Design Title 2' },
8 | { title: 'Ant Design Title 3' },
9 | { title: 'Ant Design Title 4' },
10 | ];
11 | const Demo = () => (
12 | (
16 |
17 | }
19 | title={{item.title} }
20 | description="Ant Design, a design language for background applications, is refined by Ant UED Team"
21 | />
22 |
23 | )}
24 | />
25 | );
26 |
27 | const componentDemo: ComponentDemo = {
28 | demo: ,
29 | tokens: [],
30 | key: 'default',
31 | };
32 |
33 | export default componentDemo;
34 |
--------------------------------------------------------------------------------
/src/previews/components/mentions/danger.tsx:
--------------------------------------------------------------------------------
1 | import { Mentions } from 'antd';
2 | import React from 'react';
3 | import type { ComponentDemo } from '../../../interface';
4 |
5 | const { Option } = Mentions;
6 | function onChange() {}
7 | function onSelect() {}
8 |
9 | const Demo = () => (
10 |
17 | afc163
18 | zombieJ
19 | yesmeck
20 |
21 | );
22 |
23 | const componentDemo: ComponentDemo = {
24 | demo: ,
25 | tokens: [
26 | 'colorError',
27 | 'colorErrorOutline',
28 | 'colorErrorBorder',
29 | 'colorErrorHover',
30 | ],
31 | key: 'danger',
32 | };
33 |
34 | export default componentDemo;
35 |
--------------------------------------------------------------------------------
/src/previews/components/mentions/disabled.tsx:
--------------------------------------------------------------------------------
1 | import { Mentions } from 'antd';
2 | import React from 'react';
3 | import type { ComponentDemo } from '../../../interface';
4 |
5 | const { Option } = Mentions;
6 |
7 | const Demo = () => (
8 |
14 | afc163
15 | zombieJ
16 | yesmeck
17 |
18 | );
19 |
20 | const componentDemo: ComponentDemo = {
21 | demo: ,
22 | tokens: ['colorBgContainerDisabled', 'colorTextDisabled'],
23 | key: 'disabled',
24 | };
25 |
26 | export default componentDemo;
27 |
--------------------------------------------------------------------------------
/src/previews/components/mentions/index.ts:
--------------------------------------------------------------------------------
1 | import danger from './danger';
2 | import disabled from './disabled';
3 | import Default from './mentions';
4 | import warning from './warning';
5 |
6 | import type { ComponentDemo } from '../../../interface';
7 |
8 | const previewerDemo: ComponentDemo[] = [Default, danger, warning, disabled];
9 |
10 | export default previewerDemo;
11 |
--------------------------------------------------------------------------------
/src/previews/components/mentions/mentions.tsx:
--------------------------------------------------------------------------------
1 | import { Mentions } from 'antd';
2 | import React from 'react';
3 | import type { ComponentDemo } from '../../../interface';
4 |
5 | const { Option } = Mentions;
6 | function onChange() {}
7 | function onSelect() {}
8 | const Demo = () => (
9 |
15 | afc163
16 | zombieJ
17 | yesmeck
18 |
19 | );
20 |
21 | const componentDemo: ComponentDemo = {
22 | demo: ,
23 | tokens: [
24 | 'colorBgContainer',
25 | 'colorBorder',
26 | 'colorPrimary',
27 | 'colorPrimaryHover',
28 | 'controlOutline',
29 | ],
30 | key: 'default',
31 | };
32 |
33 | export default componentDemo;
34 |
--------------------------------------------------------------------------------
/src/previews/components/mentions/warning.tsx:
--------------------------------------------------------------------------------
1 | import { Mentions } from 'antd';
2 | import React from 'react';
3 | import type { ComponentDemo } from '../../../interface';
4 |
5 | const { Option } = Mentions;
6 | function onChange() {}
7 | function onSelect() {}
8 |
9 | const Demo = () => (
10 |
17 | afc163
18 | zombieJ
19 | yesmeck
20 |
21 | );
22 |
23 | const componentDemo: ComponentDemo = {
24 | demo: ,
25 | tokens: [
26 | 'colorWarning',
27 | 'colorWarningBorder',
28 | 'colorWarningHover',
29 | 'colorWarningOutline',
30 | ],
31 | key: 'warning',
32 | };
33 |
34 | export default componentDemo;
35 |
--------------------------------------------------------------------------------
/src/previews/components/menu/data.tsx:
--------------------------------------------------------------------------------
1 | import {
2 | AppstoreOutlined,
3 | MailOutlined,
4 | SettingOutlined,
5 | } from '@ant-design/icons';
6 | import type { MenuProps } from 'antd';
7 | import React from 'react';
8 |
9 | type MenuItem = Required['items'][number];
10 |
11 | const getItem = (
12 | label: React.ReactNode,
13 | key: React.Key,
14 | icon?: React.ReactNode,
15 | children?: MenuItem[],
16 | type?: 'group',
17 | ): MenuItem =>
18 | ({
19 | key,
20 | icon,
21 | children,
22 | label,
23 | type,
24 | } as MenuItem);
25 |
26 | const items: MenuProps['items'] = [
27 | getItem('Navigation One', 'sub1', , [
28 | getItem(
29 | 'Item 1',
30 | 'g1',
31 | null,
32 | [getItem('Option 1', '1'), getItem('Option 2', '2')],
33 | 'group',
34 | ),
35 | getItem(
36 | 'Item 2',
37 | 'g2',
38 | null,
39 | [getItem('Option 3', '3'), getItem('Option 4', '4')],
40 | 'group',
41 | ),
42 | ]),
43 |
44 | getItem('Navigation Two', 'sub2', , [
45 | getItem('Option 5', '5'),
46 | getItem('Option 6', '6'),
47 | getItem('Submenu', 'sub3', null, [
48 | getItem('Option 7', '7'),
49 | getItem('Option 8', '8'),
50 | ]),
51 | ]),
52 |
53 | getItem('Navigation Three', 'sub4', , [
54 | getItem('Option 9', '9'),
55 | getItem('Option 10', '10'),
56 | getItem('Option 11', '11'),
57 | getItem('Option 12', '12'),
58 | ]),
59 | ];
60 |
61 | export default items;
62 |
--------------------------------------------------------------------------------
/src/previews/components/menu/index.ts:
--------------------------------------------------------------------------------
1 | import Default from './menu';
2 | import danger from './menuDanger';
3 | import MenuInLayout from './menuInLayout';
4 |
5 | import type { ComponentDemo } from '../../../interface';
6 |
7 | const previewerDemo: ComponentDemo[] = [Default, danger, MenuInLayout];
8 |
9 | export default previewerDemo;
10 |
--------------------------------------------------------------------------------
/src/previews/components/menu/menu.tsx:
--------------------------------------------------------------------------------
1 | import type { MenuProps } from 'antd';
2 | import { Menu } from 'antd';
3 | import React from 'react';
4 |
5 | import items from './data';
6 |
7 | import type { ComponentDemo } from '../../../interface';
8 |
9 | const Demo: React.FC = () => {
10 | const onClick: MenuProps['onClick'] = (e) => {
11 | console.log('click ', e);
12 | };
13 |
14 | return (
15 |
16 |
24 |
25 | );
26 | };
27 |
28 | const componentDemo: ComponentDemo = {
29 | demo: ,
30 | tokens: [
31 | 'colorPrimary',
32 | 'colorBgContainer',
33 | 'colorFillAlter',
34 | 'colorSplit',
35 | 'colorPrimaryHover',
36 | ],
37 | key: 'default',
38 | };
39 |
40 | export default componentDemo;
41 |
--------------------------------------------------------------------------------
/src/previews/components/menu/menuDanger.tsx:
--------------------------------------------------------------------------------
1 | import type { MenuProps } from 'antd';
2 | import { Menu } from 'antd';
3 | import React from 'react';
4 |
5 | import type { ComponentDemo } from '../../../interface';
6 |
7 | const items: MenuProps['items'] = [
8 | {
9 | key: '0',
10 | danger: true,
11 | label: '危险',
12 | },
13 | {
14 | key: '1',
15 | danger: true,
16 | label: '危险选中',
17 | },
18 | {
19 | key: '2',
20 | danger: true,
21 | disabled: true,
22 | label: '危险禁用',
23 | },
24 | ];
25 |
26 | const Demo: React.FC = () => {
27 | const onClick: MenuProps['onClick'] = (e) => {
28 | console.log('click ', e);
29 | };
30 |
31 | return (
32 |
38 | );
39 | };
40 |
41 | const componentDemo: ComponentDemo = {
42 | demo: ,
43 | tokens: ['colorError', 'colorErrorHover', 'colorErrorOutline'],
44 | key: 'danger',
45 | };
46 |
47 | export default componentDemo;
48 |
--------------------------------------------------------------------------------
/src/previews/components/menu/menuInLayout.tsx:
--------------------------------------------------------------------------------
1 | import { Menu, theme } from 'antd';
2 | import React from 'react';
3 |
4 | import items from './data';
5 |
6 | import type { ComponentDemo } from '../../../interface';
7 |
8 | const Demo: React.FC = () => {
9 | const { token } = theme.useToken();
10 | return (
11 |
12 |
19 |
20 | );
21 | };
22 |
23 | const componentDemo: ComponentDemo = {
24 | demo: ,
25 | tokens: ['colorSplit'],
26 | key: 'menuInLayout',
27 | };
28 |
29 | export default componentDemo;
30 |
--------------------------------------------------------------------------------
/src/previews/components/message/error.tsx:
--------------------------------------------------------------------------------
1 | import { message } from 'antd';
2 | import React from 'react';
3 | import type { ComponentDemo } from '../../../interface';
4 |
5 | const { _InternalPanelDoNotUseOrYouWillBeFired } = message;
6 |
7 | const Demo = () => (
8 | <_InternalPanelDoNotUseOrYouWillBeFired
9 | type={'error'}
10 | content={'这是一条异常消息,会主动消失'}
11 | />
12 | );
13 |
14 | const componentDemo: ComponentDemo = {
15 | demo: ,
16 | tokens: ['colorError'],
17 | key: 'error',
18 | };
19 |
20 | export default componentDemo;
21 |
--------------------------------------------------------------------------------
/src/previews/components/message/index.ts:
--------------------------------------------------------------------------------
1 | import error from './error';
2 | import info from './info';
3 | import Default from './message';
4 | import success from './success';
5 | import warning from './warning';
6 |
7 | import type { ComponentDemo } from '../../../interface';
8 |
9 | const previewerDemo: ComponentDemo[] = [Default, error, info, success, warning];
10 |
11 | export default previewerDemo;
12 |
--------------------------------------------------------------------------------
/src/previews/components/message/info.tsx:
--------------------------------------------------------------------------------
1 | import { message } from 'antd';
2 | import React from 'react';
3 | import type { ComponentDemo } from '../../../interface';
4 |
5 | const { _InternalPanelDoNotUseOrYouWillBeFired } = message;
6 |
7 | const Demo = () => (
8 | <_InternalPanelDoNotUseOrYouWillBeFired type={'info'} content={'Info'} />
9 | );
10 |
11 | const componentDemo: ComponentDemo = {
12 | demo: ,
13 | tokens: ['colorInfo'],
14 | key: 'info',
15 | };
16 |
17 | export default componentDemo;
18 |
--------------------------------------------------------------------------------
/src/previews/components/message/message.tsx:
--------------------------------------------------------------------------------
1 | import { message } from 'antd';
2 | import React from 'react';
3 |
4 | import type { ComponentDemo } from '../../../interface';
5 |
6 | const { _InternalPanelDoNotUseOrYouWillBeFired } = message;
7 |
8 | const Demo = () => (
9 | <_InternalPanelDoNotUseOrYouWillBeFired
10 | type={'info'}
11 | content={`Hello, Ant Design!`}
12 | />
13 | );
14 |
15 | const componentDemo: ComponentDemo = {
16 | demo: ,
17 | tokens: ['colorText', 'colorBgElevated'],
18 | key: 'message',
19 | };
20 |
21 | export default componentDemo;
22 |
--------------------------------------------------------------------------------
/src/previews/components/message/success.tsx:
--------------------------------------------------------------------------------
1 | import { message } from 'antd';
2 | import React from 'react';
3 | import type { ComponentDemo } from '../../../interface';
4 |
5 | const { _InternalPanelDoNotUseOrYouWillBeFired } = message;
6 |
7 | const Demo = () => (
8 | <_InternalPanelDoNotUseOrYouWillBeFired
9 | type={'success'}
10 | content={'这是一条成功消息,会主动消失'}
11 | />
12 | );
13 |
14 | const componentDemo: ComponentDemo = {
15 | demo: ,
16 | tokens: ['colorSuccess'],
17 | key: 'success',
18 | };
19 |
20 | export default componentDemo;
21 |
--------------------------------------------------------------------------------
/src/previews/components/message/warning.tsx:
--------------------------------------------------------------------------------
1 | import { message } from 'antd';
2 | import React from 'react';
3 | import type { ComponentDemo } from '../../../interface';
4 |
5 | const { _InternalPanelDoNotUseOrYouWillBeFired } = message;
6 |
7 | const Demo = () => (
8 | <_InternalPanelDoNotUseOrYouWillBeFired
9 | type={'warning'}
10 | content={'这是一条警告消息,会主动消失'}
11 | />
12 | );
13 |
14 | const componentDemo: ComponentDemo = {
15 | demo: ,
16 | tokens: ['colorWarning'],
17 | key: 'warning',
18 | };
19 |
20 | export default componentDemo;
21 |
--------------------------------------------------------------------------------
/src/previews/components/modal/index.ts:
--------------------------------------------------------------------------------
1 | import info from './info';
2 | import Default from './modal';
3 | import withButton from './modalWithButton';
4 | import success from './success';
5 | import warning from './warning';
6 |
7 | import type { ComponentDemo } from '../../../interface';
8 |
9 | const previewerDemo: ComponentDemo[] = [
10 | Default,
11 | info,
12 | withButton,
13 | warning,
14 | success,
15 | ];
16 |
17 | export default previewerDemo;
18 |
--------------------------------------------------------------------------------
/src/previews/components/modal/info.tsx:
--------------------------------------------------------------------------------
1 | import { Modal } from 'antd';
2 | import React from 'react';
3 | import type { ComponentDemo } from '../../../interface';
4 |
5 | const { _InternalPanelDoNotUseOrYouWillBeFired } = Modal;
6 | const Demo = () => {
7 | return (
8 | <>
9 | <_InternalPanelDoNotUseOrYouWillBeFired title="Basic Modal">
10 | Some contents...
Some contents...
Some contents...
11 |
12 | >
13 | );
14 | };
15 |
16 | const componentDemo: ComponentDemo = {
17 | demo: ,
18 | tokens: ['colorInfo'],
19 | key: 'info',
20 | };
21 | export default componentDemo;
22 |
--------------------------------------------------------------------------------
/src/previews/components/modal/modal.tsx:
--------------------------------------------------------------------------------
1 | import { Modal } from 'antd';
2 | import React from 'react';
3 |
4 | import type { ComponentDemo } from '../../../interface';
5 |
6 | const Demo = () => {
7 | return (
8 |
9 | Some contents...
Some contents...
Some contents...
10 |
11 | );
12 | };
13 |
14 | const componentDemo: ComponentDemo = {
15 | demo: ,
16 | tokens: ['colorBgElevated'],
17 | key: 'default',
18 | };
19 | export default componentDemo;
20 |
--------------------------------------------------------------------------------
/src/previews/components/modal/modalWithButton.tsx:
--------------------------------------------------------------------------------
1 | import { Button, Modal } from 'antd';
2 | import React, { useState } from 'react';
3 | import type { ComponentDemo } from '../../../interface';
4 |
5 | const Demo = () => {
6 | const [isModalVisible, setIsModalVisible] = useState(false);
7 | const showModal = () => {
8 | setIsModalVisible(true);
9 | };
10 | const handleOk = () => {
11 | setIsModalVisible(false);
12 | };
13 | const handleCancel = () => {
14 | setIsModalVisible(false);
15 | };
16 | return (
17 | <>
18 |
19 | Open Modal
20 |
21 |
27 | Some contents...
Some contents...
Some contents...
28 |
29 | >
30 | );
31 | };
32 |
33 | const componentDemo: ComponentDemo = {
34 | demo: ,
35 | tokens: ['colorBgMask'],
36 | key: 'modalWithButton',
37 | };
38 | export default componentDemo;
39 |
--------------------------------------------------------------------------------
/src/previews/components/modal/success.tsx:
--------------------------------------------------------------------------------
1 | import { Modal } from 'antd';
2 | import React from 'react';
3 |
4 | import type { ComponentDemo } from '../../../interface';
5 |
6 | const Demo = () => {
7 | return (
8 |
9 | A good news!
10 |
11 | );
12 | };
13 |
14 | const componentDemo: ComponentDemo = {
15 | demo: ,
16 | tokens: ['colorSuccess'],
17 | key: 'success',
18 | };
19 | export default componentDemo;
20 |
--------------------------------------------------------------------------------
/src/previews/components/modal/warning.tsx:
--------------------------------------------------------------------------------
1 | import { Modal } from 'antd';
2 | import React from 'react';
3 |
4 | import type { ComponentDemo } from '../../../interface';
5 |
6 | const Demo = () => {
7 | return (
8 |
14 | Some descriptions.
15 |
16 | );
17 | };
18 |
19 | const componentDemo: ComponentDemo = {
20 | demo: ,
21 | tokens: ['colorWarning'],
22 | key: 'warning',
23 | };
24 | export default componentDemo;
25 |
--------------------------------------------------------------------------------
/src/previews/components/notification/error.tsx:
--------------------------------------------------------------------------------
1 | import { notification } from 'antd';
2 | import React from 'react';
3 | import type { ComponentDemo } from '../../../interface';
4 |
5 | const { _InternalPanelDoNotUseOrYouWillBeFired } = notification;
6 |
7 | const Demo = () => (
8 | <_InternalPanelDoNotUseOrYouWillBeFired
9 | message={'Notification Title'}
10 | type={'error'}
11 | description={
12 | 'This is the content of the notification. This is the content of the notification. This is the content of the notification.'
13 | }
14 | />
15 | );
16 |
17 | const componentDemo: ComponentDemo = {
18 | demo: ,
19 | tokens: ['colorError'],
20 | key: 'error',
21 | };
22 |
23 | export default componentDemo;
24 |
--------------------------------------------------------------------------------
/src/previews/components/notification/index.ts:
--------------------------------------------------------------------------------
1 | import error from './error';
2 | import info from './info';
3 | import Demo from './notification';
4 | import success from './success';
5 | import warning from './warning';
6 |
7 | import type { ComponentDemo } from '../../../interface';
8 |
9 | const previewerDemo: ComponentDemo[] = [Demo, info, error, success, warning];
10 |
11 | export default previewerDemo;
12 |
--------------------------------------------------------------------------------
/src/previews/components/notification/info.tsx:
--------------------------------------------------------------------------------
1 | import { notification } from 'antd';
2 | import React from 'react';
3 | import type { ComponentDemo } from '../../../interface';
4 |
5 | const { _InternalPanelDoNotUseOrYouWillBeFired } = notification;
6 |
7 | const Demo = () => (
8 | <_InternalPanelDoNotUseOrYouWillBeFired
9 | message={'Notification Title'}
10 | type={'info'}
11 | description={
12 | 'This is the content of the notification. This is the content of the notification. This is the content of the notification.'
13 | }
14 | />
15 | );
16 |
17 | const componentDemo: ComponentDemo = {
18 | demo: ,
19 | tokens: ['colorInfo'],
20 | key: 'info',
21 | };
22 |
23 | export default componentDemo;
24 |
--------------------------------------------------------------------------------
/src/previews/components/notification/notification.tsx:
--------------------------------------------------------------------------------
1 | import { notification } from 'antd';
2 | import React from 'react';
3 | import type { ComponentDemo } from '../../../interface';
4 |
5 | const { _InternalPanelDoNotUseOrYouWillBeFired } = notification;
6 |
7 | const Demo = () => (
8 | <_InternalPanelDoNotUseOrYouWillBeFired
9 | message={'Notification Title'}
10 | description={
11 | 'This is the content of the notification. This is the content of the notification. This is the content of the notification.'
12 | }
13 | />
14 | );
15 |
16 | const componentDemo: ComponentDemo = {
17 | demo: ,
18 | tokens: ['colorIcon', 'colorIconHover', 'colorBgElevated'],
19 | key: 'default',
20 | };
21 |
22 | export default componentDemo;
23 |
--------------------------------------------------------------------------------
/src/previews/components/notification/success.tsx:
--------------------------------------------------------------------------------
1 | import { notification } from 'antd';
2 | import React from 'react';
3 | import type { ComponentDemo } from '../../../interface';
4 |
5 | const { _InternalPanelDoNotUseOrYouWillBeFired } = notification;
6 |
7 | const Demo = () => (
8 | <_InternalPanelDoNotUseOrYouWillBeFired
9 | message={'Notification Title'}
10 | type={'success'}
11 | description={
12 | 'This is the content of the notification. This is the content of the notification. This is the content of the notification.'
13 | }
14 | />
15 | );
16 |
17 | const componentDemo: ComponentDemo = {
18 | demo: ,
19 | tokens: ['colorSuccess'],
20 | key: 'success',
21 | };
22 |
23 | export default componentDemo;
24 |
--------------------------------------------------------------------------------
/src/previews/components/notification/warning.tsx:
--------------------------------------------------------------------------------
1 | import { notification } from 'antd';
2 | import React from 'react';
3 | import type { ComponentDemo } from '../../../interface';
4 |
5 | const { _InternalPanelDoNotUseOrYouWillBeFired } = notification;
6 |
7 | const Demo = () => (
8 | <_InternalPanelDoNotUseOrYouWillBeFired
9 | message={'Notification Title'}
10 | type={'warning'}
11 | description={
12 | 'This is the content of the notification. This is the content of the notification. This is the content of the notification.'
13 | }
14 | />
15 | );
16 |
17 | const componentDemo: ComponentDemo = {
18 | demo: ,
19 | tokens: ['colorWarning'],
20 | key: 'warning',
21 | };
22 |
23 | export default componentDemo;
24 |
--------------------------------------------------------------------------------
/src/previews/components/pagination/disabled.tsx:
--------------------------------------------------------------------------------
1 | import { Pagination } from 'antd';
2 | import React from 'react';
3 | import type { ComponentDemo } from '../../../interface';
4 |
5 | const Demo: React.FC = () => (
6 |
7 | );
8 |
9 | const componentDemo: ComponentDemo = {
10 | demo: ,
11 | tokens: [
12 | 'controlItemBgActiveDisabled',
13 | 'colorBgContainerDisabled',
14 | 'colorFillAlter',
15 | ],
16 | key: 'disabled',
17 | };
18 |
19 | export default componentDemo;
20 |
--------------------------------------------------------------------------------
/src/previews/components/pagination/index.tsx:
--------------------------------------------------------------------------------
1 | import disabled from './disabled';
2 | import outline from './outline';
3 | import Demo from './pagination';
4 |
5 | import type { ComponentDemo } from '../../../interface';
6 |
7 | const previewerDemo: ComponentDemo[] = [Demo, disabled, outline];
8 |
9 | export default previewerDemo;
10 |
--------------------------------------------------------------------------------
/src/previews/components/pagination/outline.tsx:
--------------------------------------------------------------------------------
1 | import { Pagination, Space } from 'antd';
2 | import React from 'react';
3 | import type { ComponentDemo } from '../../../interface';
4 |
5 | const Demo: React.FC = () => (
6 |
7 |
8 |
9 | );
10 |
11 | const componentDemo: ComponentDemo = {
12 | demo: ,
13 | tokens: [
14 | 'colorPrimary',
15 | 'controlOutline',
16 | 'colorPrimaryHover',
17 | 'colorBgContainer',
18 | ],
19 | key: 'outline',
20 | };
21 |
22 | export default componentDemo;
23 |
--------------------------------------------------------------------------------
/src/previews/components/pagination/pagination.tsx:
--------------------------------------------------------------------------------
1 | import { Pagination, Space } from 'antd';
2 | import React from 'react';
3 | import type { ComponentDemo } from '../../../interface';
4 |
5 | const Demo: React.FC = () => (
6 |
7 |
8 |
9 |
10 |
11 | );
12 |
13 | const componentDemo: ComponentDemo = {
14 | demo: ,
15 | tokens: ['colorPrimary', 'colorPrimaryHover', 'colorBgContainer'],
16 | key: 'default',
17 | };
18 |
19 | export default componentDemo;
20 |
--------------------------------------------------------------------------------
/src/previews/components/popconfirm/index.ts:
--------------------------------------------------------------------------------
1 | import Demo from './popconfirm';
2 |
3 | import type { ComponentDemo } from '../../../interface';
4 |
5 | const previewerDemo: ComponentDemo[] = [Demo];
6 |
7 | export default previewerDemo;
8 |
--------------------------------------------------------------------------------
/src/previews/components/popconfirm/popconfirm.tsx:
--------------------------------------------------------------------------------
1 | import { message, Popconfirm } from 'antd';
2 | import React from 'react';
3 | import type { ComponentDemo } from '../../../interface';
4 |
5 | function confirm() {
6 | message.success('Click on Yes');
7 | }
8 | function cancel() {
9 | message.error('Click on No');
10 | }
11 | const Demo = () => (
12 |
22 | );
23 |
24 | const componentDemo: ComponentDemo = {
25 | demo: ,
26 | tokens: ['colorBgElevated', 'colorWarning'],
27 | key: 'default',
28 | };
29 |
30 | export default componentDemo;
31 |
--------------------------------------------------------------------------------
/src/previews/components/popover/index.ts:
--------------------------------------------------------------------------------
1 | import Demo from './popover';
2 |
3 | import type { ComponentDemo } from '../../../interface';
4 |
5 | const previewerDemo: ComponentDemo[] = [Demo];
6 |
7 | export default previewerDemo;
8 |
--------------------------------------------------------------------------------
/src/previews/components/popover/popover.tsx:
--------------------------------------------------------------------------------
1 | import { Button, Popover } from 'antd';
2 | import React from 'react';
3 | import type { ComponentDemo } from '../../../interface';
4 |
5 | const content = (
6 |
9 | );
10 | const Demo = () => (
11 |
18 | );
19 |
20 | const componentDemo: ComponentDemo = {
21 | demo: ,
22 | tokens: ['colorBgElevated'],
23 | key: 'default',
24 | };
25 |
26 | export default componentDemo;
27 |
--------------------------------------------------------------------------------
/src/previews/components/progress/danger.tsx:
--------------------------------------------------------------------------------
1 | import { Flexbox } from '@arvinxu/layout-kit';
2 | import { Progress } from 'antd';
3 | import React from 'react';
4 | import type { ComponentDemo } from '../../../interface';
5 |
6 | const Demo: React.FC = () => (
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 | );
15 |
16 | const componentDemo: ComponentDemo = {
17 | demo: ,
18 | tokens: ['colorError'],
19 | key: 'danger',
20 | };
21 |
22 | export default componentDemo;
23 |
--------------------------------------------------------------------------------
/src/previews/components/progress/index.ts:
--------------------------------------------------------------------------------
1 | import danger from './danger';
2 | import info from './info';
3 | import Demo from './progress';
4 | import progressInBg from './progressInBg';
5 | import success from './success';
6 |
7 | import type { ComponentDemo } from '../../../interface';
8 |
9 | const previewerDemo: ComponentDemo[] = [
10 | Demo,
11 | info,
12 | danger,
13 | success,
14 | progressInBg,
15 | ];
16 |
17 | export default previewerDemo;
18 |
--------------------------------------------------------------------------------
/src/previews/components/progress/info.tsx:
--------------------------------------------------------------------------------
1 | import { Progress } from 'antd';
2 | import React from 'react';
3 | import type { ComponentDemo } from '../../../interface';
4 |
5 | const Demo: React.FC = () => (
6 | <>
7 |
8 |
9 |
10 |
11 |
12 | >
13 | );
14 |
15 | const componentDemo: ComponentDemo = {
16 | demo: ,
17 | tokens: ['colorInfo'],
18 | key: 'info',
19 | };
20 |
21 | export default componentDemo;
22 |
--------------------------------------------------------------------------------
/src/previews/components/progress/progress.tsx:
--------------------------------------------------------------------------------
1 | import { Progress } from 'antd';
2 | import React from 'react';
3 | import type { ComponentDemo } from '../../../interface';
4 |
5 | const Demo: React.FC = () => (
6 | <>
7 |
8 |
9 |
10 |
11 |
12 |
13 | >
14 | );
15 |
16 | const componentDemo: ComponentDemo = {
17 | demo: ,
18 | tokens: ['colorFillSecondary', 'colorText', 'colorBgContainer'],
19 | key: 'default',
20 | };
21 |
22 | export default componentDemo;
23 |
--------------------------------------------------------------------------------
/src/previews/components/progress/progressInBg.tsx:
--------------------------------------------------------------------------------
1 | import { Progress, theme } from 'antd';
2 | import React from 'react';
3 | import type { ComponentDemo } from '../../../interface';
4 |
5 | const Demo: React.FC = () => {
6 | const { token } = theme.useToken();
7 | return (
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 | );
17 | };
18 |
19 | const componentDemo: ComponentDemo = {
20 | demo: ,
21 | tokens: ['colorFillSecondary', 'colorText', 'colorBgContainer'],
22 | key: 'layout',
23 | };
24 |
25 | export default componentDemo;
26 |
--------------------------------------------------------------------------------
/src/previews/components/progress/success.tsx:
--------------------------------------------------------------------------------
1 | import { Flexbox } from '@arvinxu/layout-kit';
2 | import { Progress } from 'antd';
3 | import React from 'react';
4 | import type { ComponentDemo } from '../../../interface';
5 |
6 | const Demo: React.FC = () => (
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 | );
15 |
16 | const componentDemo: ComponentDemo = {
17 | demo: ,
18 | tokens: ['colorSuccess'],
19 | key: 'success',
20 | };
21 |
22 | export default componentDemo;
23 |
--------------------------------------------------------------------------------
/src/previews/components/radio/button.tsx:
--------------------------------------------------------------------------------
1 | import { Radio, Space } from 'antd';
2 | import React from 'react';
3 | import type { ComponentDemo } from '../../../interface';
4 |
5 | const Demo = () => (
6 |
7 |
8 |
9 | Hangzhou
10 |
11 | Shanghai
12 |
13 |
14 |
15 | Apple
16 | Orange
17 |
18 |
19 | );
20 |
21 | const componentDemo: ComponentDemo = {
22 | demo: ,
23 | tokens: ['colorPrimaryActive', 'colorPrimaryHover'],
24 | key: 'button',
25 | };
26 |
27 | export default componentDemo;
28 |
--------------------------------------------------------------------------------
/src/previews/components/radio/disabled.tsx:
--------------------------------------------------------------------------------
1 | import { Radio } from 'antd';
2 | import React from 'react';
3 | import type { ComponentDemo } from '../../../interface';
4 |
5 | const Demo = () => Radio ;
6 |
7 | const componentDemo: ComponentDemo = {
8 | demo: ,
9 | tokens: ['colorBgContainerDisabled'],
10 | key: 'disabled',
11 | };
12 |
13 | export default componentDemo;
14 |
--------------------------------------------------------------------------------
/src/previews/components/radio/index.ts:
--------------------------------------------------------------------------------
1 | import Button from './button';
2 | import disabled from './disabled';
3 | import Default from './radio';
4 |
5 | import type { ComponentDemo } from '../../../interface';
6 |
7 | const previewerDemo: ComponentDemo[] = [Default, Button, disabled];
8 |
9 | export default previewerDemo;
10 |
--------------------------------------------------------------------------------
/src/previews/components/radio/radio.tsx:
--------------------------------------------------------------------------------
1 | import { Radio } from 'antd';
2 | import React from 'react';
3 | import type { ComponentDemo } from '../../../interface';
4 |
5 | const Demo = () => Radio ;
6 |
7 | const componentDemo: ComponentDemo = {
8 | demo: ,
9 | tokens: ['colorPrimary', 'controlOutline', 'colorBgContainer'],
10 | key: 'default',
11 | };
12 |
13 | export default componentDemo;
14 |
--------------------------------------------------------------------------------
/src/previews/components/rate/index.ts:
--------------------------------------------------------------------------------
1 | import Demo from './rate';
2 |
3 | import type { ComponentDemo } from '../../../interface';
4 |
5 | const previewerDemo: ComponentDemo[] = [Demo];
6 |
7 | export default previewerDemo;
8 |
--------------------------------------------------------------------------------
/src/previews/components/rate/rate.tsx:
--------------------------------------------------------------------------------
1 | import { Rate } from 'antd';
2 | import React from 'react';
3 |
4 | import type { ComponentDemo } from '../../../interface';
5 |
6 | const Demo = () => ;
7 |
8 | const componentDemo: ComponentDemo = {
9 | demo: ,
10 | tokens: ['colorFillContent'],
11 | key: 'default',
12 | };
13 |
14 | export default componentDemo;
15 |
--------------------------------------------------------------------------------
/src/previews/components/result/danger.tsx:
--------------------------------------------------------------------------------
1 | import { Result } from 'antd';
2 | import React from 'react';
3 | import type { ComponentDemo } from '../../../interface';
4 |
5 | const Demo: React.FC = () => (
6 |
7 | );
8 |
9 | const componentDemo: ComponentDemo = {
10 | demo: ,
11 | tokens: ['colorError'],
12 | key: 'danger',
13 | };
14 |
15 | export default componentDemo;
16 |
--------------------------------------------------------------------------------
/src/previews/components/result/index.ts:
--------------------------------------------------------------------------------
1 | import danger from './danger';
2 | import info from './info';
3 | import Demo from './result';
4 | import ResultWithDesc from './resultWithDesc';
5 | import warning from './warning';
6 |
7 | import type { ComponentDemo } from '../../../interface';
8 |
9 | const previewerDemo: ComponentDemo[] = [
10 | Demo,
11 | info,
12 | warning,
13 | danger,
14 | ResultWithDesc,
15 | ];
16 |
17 | export default previewerDemo;
18 |
--------------------------------------------------------------------------------
/src/previews/components/result/info.tsx:
--------------------------------------------------------------------------------
1 | import { Result } from 'antd';
2 | import React from 'react';
3 | import type { ComponentDemo } from '../../../interface';
4 |
5 | const Demo: React.FC = () => (
6 |
7 | );
8 |
9 | const componentDemo: ComponentDemo = {
10 | demo: ,
11 | tokens: ['colorInfo'],
12 | key: 'info',
13 | };
14 |
15 | export default componentDemo;
16 |
--------------------------------------------------------------------------------
/src/previews/components/result/result.tsx:
--------------------------------------------------------------------------------
1 | import { Button, Result } from 'antd';
2 | import React from 'react';
3 | import type { ComponentDemo } from '../../../interface';
4 |
5 | const Demo: React.FC = () => (
6 |
12 | Go Console
13 | ,
14 | Buy Again ,
15 | ]}
16 | />
17 | );
18 |
19 | const componentDemo: ComponentDemo = {
20 | demo: ,
21 | tokens: ['colorSuccess'],
22 | key: 'result',
23 | };
24 |
25 | export default componentDemo;
26 |
--------------------------------------------------------------------------------
/src/previews/components/result/resultWithDesc.tsx:
--------------------------------------------------------------------------------
1 | import { Result } from 'antd';
2 | import React from 'react';
3 | import type { ComponentDemo } from '../../../interface';
4 |
5 | const Demo: React.FC = () => (
6 |
7 | Order number: 2017182818828182881 Cloud server configuration takes 1-5
8 | minutes, please wait.
9 |
10 | );
11 | const componentDemo: ComponentDemo = {
12 | demo: ,
13 | tokens: ['colorFillAlter'],
14 | key: 'resultWithDesc',
15 | };
16 |
17 | export default componentDemo;
18 |
--------------------------------------------------------------------------------
/src/previews/components/result/success.tsx:
--------------------------------------------------------------------------------
1 | import { Result } from 'antd';
2 | import React from 'react';
3 | import type { ComponentDemo } from '../../../interface';
4 |
5 | const Demo: React.FC = () => (
6 |
12 | );
13 |
14 | const componentDemo: ComponentDemo = {
15 | demo: ,
16 | tokens: ['colorSuccess'],
17 | key: 'result',
18 | };
19 |
20 | export default componentDemo;
21 |
--------------------------------------------------------------------------------
/src/previews/components/result/warning.tsx:
--------------------------------------------------------------------------------
1 | import { Result } from 'antd';
2 | import React from 'react';
3 | import type { ComponentDemo } from '../../../interface';
4 |
5 | const Demo: React.FC = () => (
6 |
7 | );
8 |
9 | const componentDemo: ComponentDemo = {
10 | demo: ,
11 | tokens: ['colorWarning'],
12 | key: 'warning',
13 | };
14 |
15 | export default componentDemo;
16 |
--------------------------------------------------------------------------------
/src/previews/components/segmented/index.ts:
--------------------------------------------------------------------------------
1 | import Demo from './segmented';
2 |
3 | import type { ComponentDemo } from '../../../interface';
4 |
5 | const previewerDemo: ComponentDemo[] = [Demo];
6 |
7 | export default previewerDemo;
8 |
--------------------------------------------------------------------------------
/src/previews/components/segmented/segmented.tsx:
--------------------------------------------------------------------------------
1 | import { Segmented } from 'antd';
2 | import React from 'react';
3 | import type { ComponentDemo } from '../../../interface';
4 |
5 | const Demo = () => (
6 |
7 | );
8 |
9 | const componentDemo: ComponentDemo = {
10 | demo: ,
11 | key: 'default',
12 | tokens: [],
13 | };
14 |
15 | export default componentDemo;
16 |
--------------------------------------------------------------------------------
/src/previews/components/select/_internal.ts:
--------------------------------------------------------------------------------
1 | import { Select } from 'antd';
2 |
3 | export default Select._InternalPanelDoNotUseOrYouWillBeFired;
4 |
--------------------------------------------------------------------------------
/src/previews/components/select/danger.tsx:
--------------------------------------------------------------------------------
1 | import Select from './_internal';
2 |
3 | import React from 'react';
4 | import type { ComponentDemo } from '../../../interface';
5 |
6 | import options from './data';
7 |
8 | const handleChange = (value: any) => {
9 | console.log(`selected ${value}`);
10 | };
11 |
12 | const Demo = () => (
13 |
25 | );
26 |
27 | const componentDemo: ComponentDemo = {
28 | demo: ,
29 | tokens: [
30 | 'colorError',
31 | 'colorErrorOutline',
32 | 'colorErrorBorder',
33 | 'colorErrorHover',
34 | ],
35 | key: 'danger',
36 | };
37 |
38 | export default componentDemo;
39 |
--------------------------------------------------------------------------------
/src/previews/components/select/data.ts:
--------------------------------------------------------------------------------
1 | import type { SelectProps } from 'antd';
2 |
3 | const options: SelectProps['options'] = [];
4 |
5 | for (let i = 10; i < 36; i++) {
6 | options.push({ value: i.toString(36) + i, label: i.toString(36) + i });
7 | }
8 |
9 | export default options;
10 |
--------------------------------------------------------------------------------
/src/previews/components/select/disabled.tsx:
--------------------------------------------------------------------------------
1 | import Select from './_internal';
2 |
3 | import React from 'react';
4 | import type { ComponentDemo } from '../../../interface';
5 |
6 | import options from './data';
7 |
8 | const Demo = () => (
9 |
20 | );
21 |
22 | const componentDemo: ComponentDemo = {
23 | demo: ,
24 | tokens: ['colorBgContainerDisabled', 'colorTextDisabled'],
25 | key: 'disabled',
26 | };
27 |
28 | export default componentDemo;
29 |
--------------------------------------------------------------------------------
/src/previews/components/select/icon.tsx:
--------------------------------------------------------------------------------
1 | import Select from './_internal';
2 |
3 | import React from 'react';
4 | import type { ComponentDemo } from '../../../interface';
5 |
6 | import options from './data';
7 |
8 | const handleChange = (value: any) => {
9 | console.log(`selected ${value}`);
10 | };
11 |
12 | const Demo = () => (
13 |
23 | );
24 |
25 | const componentDemo: ComponentDemo = {
26 | demo: ,
27 | tokens: ['colorIcon', 'colorIconHover'],
28 | key: 'icon',
29 | };
30 |
31 | export default componentDemo;
32 |
--------------------------------------------------------------------------------
/src/previews/components/select/index.ts:
--------------------------------------------------------------------------------
1 | import danger from './danger';
2 | import disabled from './disabled';
3 | import icon from './icon';
4 | import Default from './select';
5 | import SelectTag from './selectTag';
6 | import warning from './warning';
7 |
8 | import type { ComponentDemo } from '../../../interface';
9 |
10 | const previewerDemo: ComponentDemo[] = [
11 | Default,
12 | SelectTag,
13 | danger,
14 | warning,
15 | icon,
16 | disabled,
17 | ];
18 |
19 | export default previewerDemo;
20 |
--------------------------------------------------------------------------------
/src/previews/components/select/select.tsx:
--------------------------------------------------------------------------------
1 | import { Select as _Select, Space } from 'antd';
2 | import React from 'react';
3 | import type { ComponentDemo } from '../../../interface';
4 |
5 | const { Option, _InternalPanelDoNotUseOrYouWillBeFired: Select } = _Select;
6 |
7 | function handleChange() {}
8 | const Demo = () => (
9 |
10 |
11 | Jack Lucy
12 |
13 | Disabled
14 |
15 | yiminghe
16 |
17 |
18 | Lucy
19 |
20 |
21 | Lucy
22 |
23 |
24 | Lucy
25 |
26 |
27 | );
28 |
29 | const componentDemo: ComponentDemo = {
30 | demo: ,
31 | tokens: [
32 | 'controlOutline',
33 | 'colorPrimary',
34 | 'colorPrimaryHover',
35 | 'colorText',
36 | 'colorBgElevated',
37 | 'colorBgContainer',
38 | ],
39 | key: 'select',
40 | };
41 |
42 | export default componentDemo;
43 |
--------------------------------------------------------------------------------
/src/previews/components/select/selectTag.tsx:
--------------------------------------------------------------------------------
1 | import Select from './_internal';
2 |
3 | import React from 'react';
4 | import type { ComponentDemo } from '../../../interface';
5 |
6 | import options from './data';
7 |
8 | const handleChange = (value: any) => {
9 | console.log(`selected ${value}`);
10 | };
11 |
12 | const Demo = () => (
13 |
25 | );
26 |
27 | const componentDemo: ComponentDemo = {
28 | demo: ,
29 | tokens: ['colorPrimary', 'colorFillSecondary'],
30 | key: 'selectTag',
31 | };
32 |
33 | export default componentDemo;
34 |
--------------------------------------------------------------------------------
/src/previews/components/select/warning.tsx:
--------------------------------------------------------------------------------
1 | import Select from './_internal';
2 |
3 | import React from 'react';
4 | import type { ComponentDemo } from '../../../interface';
5 |
6 | import options from './data';
7 |
8 | const handleChange = (value: any) => {
9 | console.log(`selected ${value}`);
10 | };
11 |
12 | const Demo = () => (
13 |
25 | );
26 |
27 | const componentDemo: ComponentDemo = {
28 | demo: ,
29 | tokens: ['colorWarningHover', 'colorWarningOutline'],
30 | key: 'warning',
31 | };
32 |
33 | export default componentDemo;
34 |
--------------------------------------------------------------------------------
/src/previews/components/skeleton/index.ts:
--------------------------------------------------------------------------------
1 | import Demo from './skeleton';
2 |
3 | import type { ComponentDemo } from '../../../interface';
4 |
5 | const previewerDemo: ComponentDemo[] = [Demo];
6 |
7 | export default previewerDemo;
8 |
--------------------------------------------------------------------------------
/src/previews/components/skeleton/skeleton.tsx:
--------------------------------------------------------------------------------
1 | import { Skeleton } from 'antd';
2 | import React from 'react';
3 |
4 | import type { ComponentDemo } from '../../../interface';
5 |
6 | const Demo = () => ;
7 |
8 | const componentDemo: ComponentDemo = {
9 | demo: ,
10 | tokens: ['colorFillContent', 'colorTextPlaceholder'],
11 | key: 'default',
12 | };
13 |
14 | export default componentDemo;
15 |
--------------------------------------------------------------------------------
/src/previews/components/slider/index.ts:
--------------------------------------------------------------------------------
1 | import Demo from './slider';
2 | import SliderInBg from './sliderInBg';
3 |
4 | import type { ComponentDemo } from '../../../interface';
5 |
6 | const previewerDemo: ComponentDemo[] = [Demo, SliderInBg];
7 |
8 | export default previewerDemo;
9 |
--------------------------------------------------------------------------------
/src/previews/components/slider/slider.tsx:
--------------------------------------------------------------------------------
1 | import { Slider } from 'antd';
2 | import React from 'react';
3 | import type { ComponentDemo } from '../../../interface';
4 |
5 | const Demo = () => (
6 | <>
7 |
8 |
9 | >
10 | );
11 |
12 | const componentDemo: ComponentDemo = {
13 | demo: ,
14 | tokens: [
15 | 'colorFillSecondary',
16 | 'colorFillContentHover',
17 | 'colorBgContainer',
18 | 'colorPrimary',
19 | 'colorPrimaryHover',
20 | 'colorPrimaryBorderHover',
21 | 'colorPrimaryBorder',
22 | ],
23 | key: 'default',
24 | };
25 |
26 | export default componentDemo;
27 |
--------------------------------------------------------------------------------
/src/previews/components/slider/sliderInBg.tsx:
--------------------------------------------------------------------------------
1 | import { Slider, theme } from 'antd';
2 | import React from 'react';
3 | import type { ComponentDemo } from '../../../interface';
4 |
5 | const Demo = () => {
6 | const { token } = theme.useToken();
7 | return (
8 |
9 |
10 |
11 |
12 | );
13 | };
14 |
15 | const componentDemo: ComponentDemo = {
16 | demo: ,
17 | tokens: [
18 | 'colorFillSecondary',
19 | 'colorFillContentHover',
20 | 'colorBgContainer',
21 | 'colorPrimary',
22 | 'colorPrimaryHover',
23 | 'colorPrimaryBorderHover',
24 | 'colorPrimaryBorder',
25 | ],
26 | key: 'sliderInBg',
27 | };
28 |
29 | export default componentDemo;
30 |
--------------------------------------------------------------------------------
/src/previews/components/space/index.ts:
--------------------------------------------------------------------------------
1 | import Demo from './space';
2 |
3 | import type { ComponentDemo } from '../../../interface';
4 |
5 | const previewerDemo: ComponentDemo[] = [Demo];
6 |
7 | export default previewerDemo;
8 |
--------------------------------------------------------------------------------
/src/previews/components/space/space.tsx:
--------------------------------------------------------------------------------
1 | import { UploadOutlined } from '@ant-design/icons';
2 | import { Button, Popconfirm, Space, Upload } from 'antd';
3 | import React from 'react';
4 | import type { ComponentDemo } from '../../../interface';
5 |
6 | const Demo: React.FC = () => (
7 |
8 | Space
9 | Button
10 |
11 |
12 | Click to Upload
13 |
14 |
15 |
20 | Confirm
21 |
22 |
23 | );
24 |
25 | const componentDemo: ComponentDemo = {
26 | demo: ,
27 | key: 'default',
28 | };
29 |
30 | export default componentDemo;
31 |
--------------------------------------------------------------------------------
/src/previews/components/spin/index.ts:
--------------------------------------------------------------------------------
1 | import Default from './spin';
2 |
3 | import type { ComponentDemo } from '../../../interface';
4 |
5 | const previewerDemo: ComponentDemo[] = [Default];
6 |
7 | export default previewerDemo;
8 |
--------------------------------------------------------------------------------
/src/previews/components/spin/spin.tsx:
--------------------------------------------------------------------------------
1 | import { Spin } from 'antd';
2 | import React from 'react';
3 | import type { ComponentDemo } from '../../../interface';
4 |
5 | const Demo = () => ;
6 |
7 | const componentDemo: ComponentDemo = {
8 | demo: ,
9 | tokens: ['colorPrimary', 'colorBgContainer'],
10 | key: 'default',
11 | };
12 |
13 | export default componentDemo;
14 |
--------------------------------------------------------------------------------
/src/previews/components/statistic/index.ts:
--------------------------------------------------------------------------------
1 | import Demo from './statistic';
2 |
3 | import type { ComponentDemo } from '../../../interface';
4 |
5 | const previewerDemo: ComponentDemo[] = [Demo];
6 |
7 | export default previewerDemo;
8 |
--------------------------------------------------------------------------------
/src/previews/components/statistic/statistic.tsx:
--------------------------------------------------------------------------------
1 | import { Button, Col, Row, Statistic } from 'antd';
2 | import React from 'react';
3 | import type { ComponentDemo } from '../../../interface';
4 |
5 | const Demo = () => (
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 | Recharge
14 |
15 |
16 |
17 |
18 |
19 |
20 | );
21 |
22 | const componentDemo: ComponentDemo = {
23 | demo: ,
24 | tokens: ['colorPrimary'],
25 | key: 'default',
26 | };
27 |
28 | export default componentDemo;
29 |
--------------------------------------------------------------------------------
/src/previews/components/steps/danger.tsx:
--------------------------------------------------------------------------------
1 | import { Steps } from 'antd';
2 | import React from 'react';
3 | import type { ComponentDemo } from '../../../interface';
4 |
5 | const { Step } = Steps;
6 |
7 | const Demo: React.FC = () => (
8 |
9 |
10 |
16 |
17 | );
18 |
19 | const componentDemo: ComponentDemo = {
20 | demo: ,
21 | tokens: ['colorError'],
22 | key: 'danger',
23 | };
24 |
25 | export default componentDemo;
26 |
--------------------------------------------------------------------------------
/src/previews/components/steps/index.ts:
--------------------------------------------------------------------------------
1 | import danger from './danger';
2 | import Demo from './steps';
3 |
4 | import type { ComponentDemo } from '../../../interface';
5 |
6 | const previewerDemo: ComponentDemo[] = [Demo, danger];
7 |
8 | export default previewerDemo;
9 |
--------------------------------------------------------------------------------
/src/previews/components/steps/steps.tsx:
--------------------------------------------------------------------------------
1 | import { Steps } from 'antd';
2 | import React from 'react';
3 | import type { ComponentDemo } from '../../../interface';
4 |
5 | const { Step } = Steps;
6 |
7 | const Demo: React.FC = () => (
8 |
9 |
10 |
15 |
16 |
17 | );
18 |
19 | const componentDemo: ComponentDemo = {
20 | demo: ,
21 | tokens: ['colorPrimary', 'colorBgContainer'],
22 | key: 'default',
23 | };
24 |
25 | export default componentDemo;
26 |
--------------------------------------------------------------------------------
/src/previews/components/switch/index.ts:
--------------------------------------------------------------------------------
1 | import Demo from './switch';
2 |
3 | import type { ComponentDemo } from '../../../interface';
4 |
5 | const previewerDemo: ComponentDemo[] = [Demo];
6 |
7 | export default previewerDemo;
8 |
--------------------------------------------------------------------------------
/src/previews/components/switch/switch.tsx:
--------------------------------------------------------------------------------
1 | import { Switch } from 'antd';
2 | import React from 'react';
3 | import type { ComponentDemo } from '../../../interface';
4 |
5 | function onChange() {}
6 | const Demo = () => ;
7 |
8 | const componentDemo: ComponentDemo = {
9 | demo: ,
10 | tokens: ['colorPrimary', 'controlOutline', 'colorBgContainer'],
11 | key: 'default',
12 | };
13 |
14 | export default componentDemo;
15 |
--------------------------------------------------------------------------------
/src/previews/components/table/index.ts:
--------------------------------------------------------------------------------
1 | import Filter from './filterTable';
2 | import Default from './table';
3 |
4 | import type { ComponentDemo } from '../../../interface';
5 |
6 | const previewerDemo: ComponentDemo[] = [Default, Filter];
7 |
8 | export default previewerDemo;
9 |
--------------------------------------------------------------------------------
/src/previews/components/table/table.tsx:
--------------------------------------------------------------------------------
1 | import { Space, Table, Tag } from 'antd';
2 | import React from 'react';
3 | import type { ComponentDemo } from '../../../interface';
4 |
5 | const columns = [
6 | {
7 | title: 'Name',
8 | dataIndex: 'name',
9 | key: 'name',
10 | render: (text: string) => {text} ,
11 | },
12 | { title: 'Age', dataIndex: 'age', key: 'age' },
13 | { title: 'Address', dataIndex: 'address', key: 'address' },
14 | {
15 | title: 'Tags',
16 | key: 'tags',
17 | dataIndex: 'tags',
18 | render: (tags: string[]) => (
19 | <>
20 | {tags.map((tag: string) => {
21 | let color = tag.length > 5 ? 'geekblue' : 'green';
22 | if (tag === 'loser') {
23 | color = 'volcano';
24 | }
25 | return (
26 |
27 | {tag.toUpperCase()}
28 |
29 | );
30 | })}
31 | >
32 | ),
33 | },
34 | {
35 | title: 'Action',
36 | key: 'action',
37 | render: (_: string, record: any) => (
38 |
39 | Invite {record.name} Delete
40 |
41 | ),
42 | },
43 | ];
44 | const data = [
45 | {
46 | key: '1',
47 | name: 'John Brown',
48 | age: 32,
49 | address: 'New York No. 1 Lake Park',
50 | tags: ['nice', 'developer'],
51 | },
52 | {
53 | key: '2',
54 | name: 'Jim Green',
55 | age: 42,
56 | address: 'London No. 1 Lake Park',
57 | tags: ['loser'],
58 | },
59 | {
60 | key: '3',
61 | name: 'Joe Black',
62 | age: 32,
63 | address: 'Sidney No. 1 Lake Park',
64 | tags: ['cool', 'teacher'],
65 | },
66 | ];
67 | const Demo = () => (
68 |
69 | );
70 |
71 | const componentDemo: ComponentDemo = {
72 | demo: ,
73 | tokens: ['colorPrimaryActive', 'colorBgContainer'],
74 | key: 'table',
75 | };
76 |
77 | export default componentDemo;
78 |
--------------------------------------------------------------------------------
/src/previews/components/tabs/cardTabs.tsx:
--------------------------------------------------------------------------------
1 | import { Tabs } from 'antd';
2 | import React from 'react';
3 | import type { ComponentDemo } from '../../../interface';
4 |
5 | const { TabPane } = Tabs;
6 |
7 | const Demo = () => (
8 |
9 |
10 | Content of Tab Pane 1
11 |
12 |
13 | Content of Tab Pane 2
14 |
15 |
16 | Content of Tab Pane 3
17 |
18 |
19 | );
20 |
21 | const componentDemo: ComponentDemo = {
22 | demo: ,
23 | tokens: ['colorFillAlter'],
24 | key: 'cardTabs',
25 | };
26 |
27 | export default componentDemo;
28 |
--------------------------------------------------------------------------------
/src/previews/components/tabs/index.ts:
--------------------------------------------------------------------------------
1 | import card from './cardTabs';
2 | import Default from './tabs';
3 |
4 | import type { ComponentDemo } from '../../../interface';
5 |
6 | const previewerDemo: ComponentDemo[] = [Default, card];
7 |
8 | export default previewerDemo;
9 |
--------------------------------------------------------------------------------
/src/previews/components/tabs/tabs.tsx:
--------------------------------------------------------------------------------
1 | import { Tabs } from 'antd';
2 | import React from 'react';
3 | import type { ComponentDemo } from '../../../interface';
4 |
5 | const { TabPane } = Tabs;
6 | function callback() {}
7 | const Demo = () => (
8 |
9 |
10 | Content of Tab Pane 1
11 |
12 |
13 | Content of Tab Pane 2
14 |
15 |
16 | Content of Tab Pane 3
17 |
18 |
19 | );
20 |
21 | const componentDemo: ComponentDemo = {
22 | demo: ,
23 | tokens: [
24 | 'colorPrimary',
25 | 'colorPrimaryHover',
26 | 'colorPrimaryActive',
27 | 'colorBgContainer',
28 | ],
29 | key: 'default',
30 | };
31 |
32 | export default componentDemo;
33 |
--------------------------------------------------------------------------------
/src/previews/components/tag/closable.tsx:
--------------------------------------------------------------------------------
1 | import { Tag } from 'antd';
2 | import React from 'react';
3 | import type { ComponentDemo } from '../../../interface';
4 |
5 | const Demo = () => Error ;
6 |
7 | const componentDemo: ComponentDemo = {
8 | demo: ,
9 | tokens: ['colorFillAlter', 'colorIcon', 'colorIconHover'],
10 | key: 'closable',
11 | };
12 |
13 | export default componentDemo;
14 |
--------------------------------------------------------------------------------
/src/previews/components/tag/error.tsx:
--------------------------------------------------------------------------------
1 | import { Tag } from 'antd';
2 | import React from 'react';
3 | import type { ComponentDemo } from '../../../interface';
4 |
5 | const Demo = () => Error ;
6 |
7 | const componentDemo: ComponentDemo = {
8 | demo: ,
9 | tokens: ['colorError', 'colorErrorBg', 'colorErrorBorder'],
10 | key: 'error',
11 | };
12 |
13 | export default componentDemo;
14 |
--------------------------------------------------------------------------------
/src/previews/components/tag/index.ts:
--------------------------------------------------------------------------------
1 | import closable from './closable';
2 | import error from './error';
3 | import info from './info';
4 | import multiTags from './multiTags';
5 | import success from './success';
6 | import Default from './tag';
7 | import warning from './warning';
8 |
9 | import type { ComponentDemo } from '../../../interface';
10 |
11 | const previewerDemo: ComponentDemo[] = [
12 | Default,
13 | error,
14 | info,
15 | success,
16 | warning,
17 | multiTags,
18 | closable,
19 | ];
20 |
21 | export default previewerDemo;
22 |
--------------------------------------------------------------------------------
/src/previews/components/tag/info.tsx:
--------------------------------------------------------------------------------
1 | import { Tag } from 'antd';
2 | import React from 'react';
3 | import type { ComponentDemo } from '../../../interface';
4 |
5 | const Demo = () => Info ;
6 |
7 | const componentDemo: ComponentDemo = {
8 | demo: ,
9 | tokens: ['colorInfo', 'colorInfoBg', 'colorInfoBorder'],
10 | key: 'info',
11 | };
12 |
13 | export default componentDemo;
14 |
--------------------------------------------------------------------------------
/src/previews/components/tag/multiTags.tsx:
--------------------------------------------------------------------------------
1 | import { Tag } from 'antd';
2 | import React from 'react';
3 | import type { ComponentDemo } from '../../../interface';
4 |
5 | const { CheckableTag } = Tag;
6 |
7 | const Checkable = () => (
8 |
9 | Error
10 | Error
11 |
12 | );
13 |
14 | const componentDemo: ComponentDemo = {
15 | demo: ,
16 | tokens: ['colorPrimary', 'colorPrimaryHover', 'colorPrimaryActive'],
17 | key: 'multiTags',
18 | };
19 |
20 | export default componentDemo;
21 |
--------------------------------------------------------------------------------
/src/previews/components/tag/success.tsx:
--------------------------------------------------------------------------------
1 | import { Tag } from 'antd';
2 | import React from 'react';
3 | import type { ComponentDemo } from '../../../interface';
4 |
5 | const Demo = () => Success ;
6 |
7 | const componentDemo: ComponentDemo = {
8 | demo: ,
9 | tokens: ['colorSuccess', 'colorSuccessBg', 'colorSuccessBorder'],
10 | key: 'success',
11 | };
12 |
13 | export default componentDemo;
14 |
--------------------------------------------------------------------------------
/src/previews/components/tag/warning.tsx:
--------------------------------------------------------------------------------
1 | import { Tag } from 'antd';
2 | import React from 'react';
3 | import type { ComponentDemo } from '../../../interface';
4 |
5 | const Demo = () => Warning ;
6 |
7 | const componentDemo: ComponentDemo = {
8 | demo: ,
9 | tokens: ['colorWarning', 'colorWarningBg', 'colorWarningBorder'],
10 | key: 'warning',
11 | };
12 |
13 | export default componentDemo;
14 |
--------------------------------------------------------------------------------
/src/previews/components/timePicker/index.ts:
--------------------------------------------------------------------------------
1 | import Demo from './time-picker';
2 |
3 | import type { ComponentDemo } from '../../../interface';
4 |
5 | const previewerDemo: ComponentDemo[] = [Demo];
6 |
7 | export default previewerDemo;
8 |
--------------------------------------------------------------------------------
/src/previews/components/timePicker/time-picker.tsx:
--------------------------------------------------------------------------------
1 | import { TimePicker } from 'antd';
2 | import React from 'react';
3 | import type { ComponentDemo } from '../../../interface';
4 |
5 | const Demo = () => ;
6 |
7 | const componentDemo: ComponentDemo = {
8 | demo: ,
9 | tokens: ['colorPrimary'],
10 | key: 'default',
11 | };
12 |
13 | export default componentDemo;
14 |
--------------------------------------------------------------------------------
/src/previews/components/timeline/danger.tsx:
--------------------------------------------------------------------------------
1 | import { Timeline } from 'antd';
2 | import React from 'react';
3 | import type { ComponentDemo } from '../../../interface';
4 |
5 | const Demo = () => (
6 |
7 |
8 | Create a services site 2015-09-01
9 |
10 |
11 | Solve initial network problems 2015-09-01
12 |
13 | Technical testing 2015-09-01
14 |
15 | Network problems being solved 2015-09-01
16 |
17 |
18 | );
19 |
20 | const componentDemo: ComponentDemo = {
21 | demo: ,
22 | tokens: ['colorError'],
23 | key: 'danger',
24 | };
25 |
26 | export default componentDemo;
27 |
--------------------------------------------------------------------------------
/src/previews/components/timeline/index.ts:
--------------------------------------------------------------------------------
1 | import danger from './danger';
2 | import success from './success';
3 | import Default from './timeline';
4 |
5 | import type { ComponentDemo } from '../../../interface';
6 |
7 | const previewerDemo: ComponentDemo[] = [Default, danger, success];
8 |
9 | export default previewerDemo;
10 |
--------------------------------------------------------------------------------
/src/previews/components/timeline/success.tsx:
--------------------------------------------------------------------------------
1 | import { Timeline } from 'antd';
2 | import React from 'react';
3 | import type { ComponentDemo } from '../../../interface';
4 |
5 | const Demo = () => (
6 |
7 |
8 | Create a services site 2015-09-01
9 |
10 |
11 | Solve initial network problems 2015-09-01
12 |
13 | Technical testing 2015-09-01
14 |
15 | Network problems being solved 2015-09-01
16 |
17 |
18 | );
19 |
20 | const componentDemo: ComponentDemo = {
21 | demo: ,
22 | tokens: ['colorSuccess'],
23 | key: 'success',
24 | };
25 |
26 | export default componentDemo;
27 |
--------------------------------------------------------------------------------
/src/previews/components/timeline/timeline.tsx:
--------------------------------------------------------------------------------
1 | import { Timeline } from 'antd';
2 | import React from 'react';
3 | import type { ComponentDemo } from '../../../interface';
4 |
5 | const Demo = () => (
6 |
7 | Create a services site 2015-09-01
8 | Solve initial network problems 2015-09-01
9 | Technical testing 2015-09-01
10 | {/*Network problems being solved 2015-09-01 */}
11 |
12 | );
13 |
14 | const componentDemo: ComponentDemo = {
15 | demo: ,
16 | tokens: ['colorPrimary', 'colorText', 'colorSplit', 'colorBgContainer'],
17 | key: 'default',
18 | };
19 |
20 | export default componentDemo;
21 |
--------------------------------------------------------------------------------
/src/previews/components/tooltip/index.ts:
--------------------------------------------------------------------------------
1 | import Demo from './tooltip';
2 |
3 | import type { ComponentDemo } from '../../../interface';
4 |
5 | const previewerDemo: ComponentDemo[] = [Demo];
6 |
7 | export default previewerDemo;
8 |
--------------------------------------------------------------------------------
/src/previews/components/tooltip/tooltip.tsx:
--------------------------------------------------------------------------------
1 | import { Tooltip } from 'antd';
2 | import React from 'react';
3 | import type { ComponentDemo } from '../../../interface';
4 |
5 | const Demo = () => (
6 |
7 |
8 | Tooltip will show on mouse enter.
9 |
10 | );
11 | const componentDemo: ComponentDemo = {
12 | demo: ,
13 | tokens: ['colorBgSpotlight', 'colorTextLightSolid'],
14 | key: 'default',
15 | };
16 |
17 | export default componentDemo;
18 |
--------------------------------------------------------------------------------
/src/previews/components/transfer/danger.tsx:
--------------------------------------------------------------------------------
1 | import { Transfer } from 'antd';
2 | import type { Key} from 'react';
3 | import React, { useState } from 'react';
4 |
5 | import type { ComponentDemo } from '../../../interface';
6 |
7 | import mockData from './data';
8 |
9 | const initialTargetKeys = mockData
10 | .filter((item) => +item.key > 10)
11 | .map((item) => item.key);
12 |
13 | const Demo = () => {
14 | const [targetKeys, setTargetKeys] = useState(initialTargetKeys);
15 | const [selectedKeys, setSelectedKeys] = useState([]);
16 | const onScroll = () => {};
17 | return (
18 | {
25 | setTargetKeys(nextTargetKeys);
26 | }}
27 | onSelectChange={(sourceSelectedKeys, targetSelectedKeys) => {
28 | setSelectedKeys([...sourceSelectedKeys, ...targetSelectedKeys]);
29 | }}
30 | onScroll={onScroll}
31 | render={(item) => item.title}
32 | />
33 | );
34 | };
35 |
36 | const componentDemo: ComponentDemo = {
37 | demo: ,
38 | tokens: ['colorError'],
39 | key: 'danger',
40 | };
41 |
42 | export default componentDemo;
43 |
--------------------------------------------------------------------------------
/src/previews/components/transfer/data.ts:
--------------------------------------------------------------------------------
1 | const mockData: any[] = [];
2 | for (let i = 0; i < 20; i++) {
3 | mockData.push({
4 | key: i.toString(),
5 | title: `content${i + 1}`,
6 | description: `description of content${i + 1}`,
7 | });
8 | }
9 | export default mockData;
10 |
--------------------------------------------------------------------------------
/src/previews/components/transfer/disabled.tsx:
--------------------------------------------------------------------------------
1 | import { Transfer } from 'antd';
2 | import type { Key} from 'react';
3 | import React, { useState } from 'react';
4 |
5 | import type { ComponentDemo } from '../../../interface';
6 |
7 | const mockData: any[] = [];
8 | for (let i = 0; i < 20; i++) {
9 | mockData.push({
10 | key: i.toString(),
11 | title: `content${i + 1}`,
12 | description: `description of content${i + 1}`,
13 | });
14 | }
15 |
16 | const initialTargetKeys = mockData
17 | .filter((item) => +item.key > 10)
18 | .map((item) => item.key);
19 |
20 | const Demo = () => {
21 | const [targetKeys, setTargetKeys] = useState(initialTargetKeys);
22 | const [selectedKeys, setSelectedKeys] = useState([]);
23 | const onScroll = () => {};
24 | return (
25 | {
32 | setTargetKeys(nextTargetKeys);
33 | }}
34 | onSelectChange={(sourceSelectedKeys, targetSelectedKeys) => {
35 | setSelectedKeys([...sourceSelectedKeys, ...targetSelectedKeys]);
36 | }}
37 | onScroll={onScroll}
38 | render={(item) => item.title}
39 | />
40 | );
41 | };
42 |
43 | const componentDemo: ComponentDemo = {
44 | demo: ,
45 | tokens: ['colorBgContainerDisabled'],
46 | key: 'disabled',
47 | };
48 |
49 | export default componentDemo;
50 |
--------------------------------------------------------------------------------
/src/previews/components/transfer/index.ts:
--------------------------------------------------------------------------------
1 | import danger from './danger';
2 | import disabled from './disabled';
3 | import Default from './transfer';
4 | import warning from './warning';
5 |
6 | import type { ComponentDemo } from '../../../interface';
7 |
8 | const previewerDemo: ComponentDemo[] = [Default, warning, danger, disabled];
9 |
10 | export default previewerDemo;
11 |
--------------------------------------------------------------------------------
/src/previews/components/transfer/transfer.tsx:
--------------------------------------------------------------------------------
1 | import { Transfer } from 'antd';
2 | import type { Key} from 'react';
3 | import React, { useState } from 'react';
4 |
5 | import type { ComponentDemo } from '../../../interface';
6 | import mockData from './data';
7 |
8 | const initialTargetKeys = mockData
9 | .filter((item) => +item.key > 10)
10 | .map((item) => item.key);
11 |
12 | const Demo = () => {
13 | const [targetKeys, setTargetKeys] = useState(initialTargetKeys);
14 | const [selectedKeys, setSelectedKeys] = useState(['1', '2']);
15 | const onScroll = () => {};
16 | return (
17 | {
23 | setTargetKeys(nextTargetKeys);
24 | }}
25 | onSelectChange={(sourceSelectedKeys, targetSelectedKeys) => {
26 | setSelectedKeys([...sourceSelectedKeys, ...targetSelectedKeys]);
27 | }}
28 | onScroll={onScroll}
29 | render={(item) => item.title}
30 | />
31 | );
32 | };
33 |
34 | const componentDemo: ComponentDemo = {
35 | demo: ,
36 | tokens: [
37 | 'controlItemBgActiveHover',
38 | 'controlItemBgActive',
39 | 'colorBgContainer',
40 | ],
41 | key: 'default',
42 | };
43 |
44 | export default componentDemo;
45 |
--------------------------------------------------------------------------------
/src/previews/components/transfer/warning.tsx:
--------------------------------------------------------------------------------
1 | import { Transfer } from 'antd';
2 | import type { Key} from 'react';
3 | import React, { useState } from 'react';
4 |
5 | import type { ComponentDemo } from '../../../interface';
6 |
7 | const mockData: any[] = [];
8 | for (let i = 0; i < 20; i++) {
9 | mockData.push({
10 | key: i.toString(),
11 | title: `content${i + 1}`,
12 | description: `description of content${i + 1}`,
13 | });
14 | }
15 |
16 | const initialTargetKeys = mockData
17 | .filter((item) => +item.key > 10)
18 | .map((item) => item.key);
19 |
20 | const Demo = () => {
21 | const [targetKeys, setTargetKeys] = useState(initialTargetKeys);
22 | const [selectedKeys, setSelectedKeys] = useState([]);
23 | const onScroll = () => {};
24 | return (
25 | {
32 | setTargetKeys(nextTargetKeys);
33 | }}
34 | onSelectChange={(sourceSelectedKeys, targetSelectedKeys) => {
35 | setSelectedKeys([...sourceSelectedKeys, ...targetSelectedKeys]);
36 | }}
37 | onScroll={onScroll}
38 | render={(item) => item.title}
39 | />
40 | );
41 | };
42 |
43 | const componentDemo: ComponentDemo = {
44 | demo: ,
45 | tokens: ['colorWarning'],
46 | key: 'warning',
47 | };
48 |
49 | export default componentDemo;
50 |
--------------------------------------------------------------------------------
/src/previews/components/tree/disabled.tsx:
--------------------------------------------------------------------------------
1 | import { Tree } from 'antd';
2 | import React from 'react';
3 | import type { ComponentDemo } from '../../../interface';
4 |
5 | const treeData = [
6 | {
7 | title: 'parent 1',
8 | key: '0-0',
9 | children: [
10 | {
11 | title: 'parent 1-0',
12 | key: '0-0-0',
13 | disabled: true,
14 | children: [
15 | { title: 'leaf', key: '0-0-0-0', disableCheckbox: true },
16 | { title: 'leaf', key: '0-0-0-1' },
17 | ],
18 | },
19 | {
20 | title: 'parent 1-1',
21 | key: '0-0-1',
22 | children: [
23 | {
24 | title: sss ,
25 | key: '0-0-1-0',
26 | },
27 | ],
28 | },
29 | ],
30 | },
31 | ];
32 | const Demo = () => {
33 | return (
34 |
42 | );
43 | };
44 |
45 | const componentDemo: ComponentDemo = {
46 | demo: ,
47 | tokens: ['colorTextDisabled', 'colorBgContainerDisabled'],
48 | key: 'disabled',
49 | };
50 |
51 | export default componentDemo;
52 |
--------------------------------------------------------------------------------
/src/previews/components/tree/index.ts:
--------------------------------------------------------------------------------
1 | import disabled from './disabled';
2 | import Demo from './tree';
3 |
4 | import type { ComponentDemo } from '../../../interface';
5 |
6 | const previewerDemo: ComponentDemo[] = [Demo, disabled];
7 |
8 | export default previewerDemo;
9 |
--------------------------------------------------------------------------------
/src/previews/components/tree/tree.tsx:
--------------------------------------------------------------------------------
1 | import { Tree } from 'antd';
2 | import React from 'react';
3 | import type { ComponentDemo } from '../../../interface';
4 |
5 | const treeData = [
6 | {
7 | title: 'parent 1',
8 | key: '0-0',
9 | children: [
10 | {
11 | title: 'parent 1-0',
12 | key: '0-0-0',
13 | disabled: true,
14 | children: [
15 | { title: 'leaf', key: '0-0-0-0', disableCheckbox: true },
16 | { title: 'leaf', key: '0-0-0-1' },
17 | ],
18 | },
19 | {
20 | title: 'parent 1-1',
21 | key: '0-0-1',
22 | children: [
23 | {
24 | title: sss ,
25 | key: '0-0-1-0',
26 | },
27 | ],
28 | },
29 | ],
30 | },
31 | ];
32 | const Demo = () => {
33 | return (
34 |
41 | );
42 | };
43 |
44 | const componentDemo: ComponentDemo = {
45 | demo: ,
46 | tokens: ['colorPrimary', 'controlOutline', 'colorBgContainer'],
47 | key: 'default',
48 | };
49 |
50 | export default componentDemo;
51 |
--------------------------------------------------------------------------------
/src/previews/components/treeSelect/disabled.tsx:
--------------------------------------------------------------------------------
1 | import { TreeSelect as _TreeSelect } from 'antd';
2 | import React, { useState } from 'react';
3 | import type { ComponentDemo } from '../../../interface';
4 |
5 | const { TreeNode, _InternalPanelDoNotUseOrYouWillBeFired: TreeSelect } =
6 | _TreeSelect;
7 |
8 | const Demo = () => {
9 | const [value, setValue] = useState(undefined);
10 | const onChange = () => {
11 | setValue(value);
12 | };
13 | return (
14 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 | );
36 | };
37 |
38 | const componentDemo: ComponentDemo = {
39 | demo: ,
40 | tokens: ['colorTextDisabled', 'colorBgContainerDisabled'],
41 | key: 'disabled',
42 | };
43 |
44 | export default componentDemo;
45 |
--------------------------------------------------------------------------------
/src/previews/components/treeSelect/index.ts:
--------------------------------------------------------------------------------
1 | import disabled from './disabled';
2 | import Default from './tree-select';
3 |
4 | import type { ComponentDemo } from '../../../interface';
5 |
6 | const previewerDemo: ComponentDemo[] = [Default, disabled];
7 |
8 | export default previewerDemo;
9 |
--------------------------------------------------------------------------------
/src/previews/components/treeSelect/tree-select.tsx:
--------------------------------------------------------------------------------
1 | import { TreeSelect as _TreeSelect } from 'antd';
2 | import React, { useState } from 'react';
3 | import type { ComponentDemo } from '../../../interface';
4 |
5 | const { TreeNode, _InternalPanelDoNotUseOrYouWillBeFired: TreeSelect } =
6 | _TreeSelect;
7 |
8 | const Demo = () => {
9 | const [value, setValue] = useState(undefined);
10 | const onChange = () => {
11 | setValue(value);
12 | };
13 | return (
14 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 | );
35 | };
36 |
37 | const componentDemo: ComponentDemo = {
38 | demo: ,
39 | tokens: [
40 | 'colorPrimary',
41 | 'colorPrimaryActive',
42 | 'controlOutline',
43 | 'colorBgElevated',
44 | 'colorBgContainer',
45 | ],
46 | key: 'default',
47 | };
48 |
49 | export default componentDemo;
50 |
--------------------------------------------------------------------------------
/src/previews/components/typography/Heading4.tsx:
--------------------------------------------------------------------------------
1 | import { Typography } from 'antd';
2 | import React from 'react';
3 | import type { ComponentDemo } from '../../../interface';
4 |
5 | const { Title } = Typography;
6 |
7 | const Demo = () => Heading 4 ;
8 |
9 | const componentDemo: ComponentDemo = {
10 | demo: ,
11 | tokens: ['fontSizeHeading4'],
12 | key: 'heading4',
13 | };
14 |
15 | export default componentDemo;
16 |
--------------------------------------------------------------------------------
/src/previews/components/typography/error.tsx:
--------------------------------------------------------------------------------
1 | import { Typography } from 'antd';
2 | import React from 'react';
3 | import type { ComponentDemo } from '../../../interface';
4 |
5 | const { Title, Text } = Typography;
6 |
7 | const Demo = () => (
8 |
9 |
10 | Error Title
11 |
12 | error Text
13 |
14 | );
15 |
16 | const componentDemo: ComponentDemo = {
17 | demo: ,
18 | tokens: ['colorError', 'colorErrorHover', 'colorErrorActive'],
19 | key: 'error',
20 | };
21 |
22 | export default componentDemo;
23 |
--------------------------------------------------------------------------------
/src/previews/components/typography/index.tsx:
--------------------------------------------------------------------------------
1 | import error from './error';
2 | import Heading4 from './Heading4';
3 | import success from './success';
4 | import TypographyDemo from './typography';
5 | import warning from './warning';
6 |
7 | import type { ComponentDemo } from '../../../interface';
8 |
9 | const previewerDemo: ComponentDemo[] = [
10 | TypographyDemo,
11 | Heading4,
12 | error,
13 | warning,
14 | success,
15 | ];
16 |
17 | export default previewerDemo;
18 |
--------------------------------------------------------------------------------
/src/previews/components/typography/success.tsx:
--------------------------------------------------------------------------------
1 | import { Typography } from 'antd';
2 | import React from 'react';
3 | import type { ComponentDemo } from '../../../interface';
4 |
5 | const { Title, Text } = Typography;
6 |
7 | const Demo = () => (
8 |
9 |
10 | Success Title
11 |
12 | success Text
13 |
14 | );
15 |
16 | const componentDemo: ComponentDemo = {
17 | demo: ,
18 | tokens: ['colorSuccess'],
19 | key: 'success',
20 | };
21 |
22 | export default componentDemo;
23 |
--------------------------------------------------------------------------------
/src/previews/components/typography/typography.tsx:
--------------------------------------------------------------------------------
1 | import { Typography } from 'antd';
2 | import React from 'react';
3 | import type { ComponentDemo } from '../../../interface';
4 |
5 | const { Title, Paragraph, Text, Link } = Typography;
6 | const Demo = () => (
7 |
8 | 《故乡》
9 | ——鲁迅
10 |
11 | 深蓝的天空中挂着一轮金黄的圆月
12 | ,下面是海边的沙地,都种着一望无际的碧绿的西瓜,其间有一个十一二岁的少年,项带银圈,手捏一柄钢叉,
13 | 向一匹猹尽力的刺去
14 | ,那猹却将身一扭,反从他的胯下逃走了。
15 |
16 |
17 |
18 |
19 | 狂人日记
20 |
21 |
22 | 呐喊
23 |
24 |
25 | 彷徨
26 |
27 |
28 |
29 |
30 | );
31 |
32 | const componentDemo: ComponentDemo = {
33 | demo: ,
34 | tokens: ['colorSuccess'],
35 | key: 'default',
36 | };
37 |
38 | export default componentDemo;
39 |
--------------------------------------------------------------------------------
/src/previews/components/typography/warning.tsx:
--------------------------------------------------------------------------------
1 | import { Typography } from 'antd';
2 | import React from 'react';
3 | import type { ComponentDemo } from '../../../interface';
4 |
5 | const { Title, Text } = Typography;
6 |
7 | const Demo = () => (
8 |
9 |
10 | Error Title
11 |
12 | error Text
13 |
14 | );
15 |
16 | const componentDemo: ComponentDemo = {
17 | demo: ,
18 | tokens: ['colorWarning'],
19 | key: 'warning',
20 | };
21 |
22 | export default componentDemo;
23 |
--------------------------------------------------------------------------------
/src/previews/components/typography/warningText.tsx:
--------------------------------------------------------------------------------
1 | import { Typography } from 'antd';
2 | import React from 'react';
3 | import type { ComponentDemo } from '../../../interface';
4 |
5 | const { Text } = Typography;
6 |
7 | const Demo = () => (
8 |
9 | Warning Title
10 |
11 | );
12 |
13 | const componentDemo: ComponentDemo = {
14 | demo: ,
15 | tokens: ['colorWarning'],
16 | key: 'warning',
17 | };
18 |
19 | export default componentDemo;
20 |
--------------------------------------------------------------------------------
/src/previews/components/typography/warningTitle.tsx:
--------------------------------------------------------------------------------
1 | import { Typography } from 'antd';
2 | import React from 'react';
3 | import type { ComponentDemo } from '../../../interface';
4 |
5 | const { Title } = Typography;
6 |
7 | const Demo = () => (
8 |
9 |
10 | Warning Text
11 |
12 |
13 | );
14 |
15 | const componentDemo: ComponentDemo = {
16 | demo: ,
17 | tokens: ['colorWarning'],
18 | key: 'warning',
19 | };
20 |
21 | export default componentDemo;
22 |
--------------------------------------------------------------------------------
/src/previews/components/upload/avatar.tsx:
--------------------------------------------------------------------------------
1 | import { PlusOutlined } from '@ant-design/icons';
2 | import { Upload } from 'antd';
3 | import React from 'react';
4 |
5 | import type { ComponentDemo } from '../../../interface';
6 |
7 | const Demo = () => (
8 |
22 | );
23 |
24 | const componentDemo: ComponentDemo = {
25 | demo: ,
26 | tokens: ['colorFillAlter'],
27 | key: 'avatar',
28 | };
29 |
30 | export default componentDemo;
31 |
--------------------------------------------------------------------------------
/src/previews/components/upload/danger.tsx:
--------------------------------------------------------------------------------
1 | import { UploadOutlined } from '@ant-design/icons';
2 | import { Button, Upload } from 'antd';
3 | import React from 'react';
4 |
5 | import type { ComponentDemo } from '../../../interface';
6 |
7 | const Demo = () => (
8 |
9 |
20 | }>Upload
21 |
22 |
33 | }>Upload
34 |
35 |
36 | );
37 |
38 | const componentDemo: ComponentDemo = {
39 | demo: ,
40 | tokens: ['colorError', 'colorErrorBg'],
41 | key: 'danger',
42 | };
43 |
44 | export default componentDemo;
45 |
--------------------------------------------------------------------------------
/src/previews/components/upload/index.ts:
--------------------------------------------------------------------------------
1 | import avatar from './avatar';
2 | import danger from './danger';
3 | import Default from './upload';
4 |
5 | import type { ComponentDemo } from '../../../interface';
6 |
7 | const previewerDemo: ComponentDemo[] = [Default, danger, avatar];
8 |
9 | export default previewerDemo;
10 |
--------------------------------------------------------------------------------
/src/previews/components/upload/upload.tsx:
--------------------------------------------------------------------------------
1 | import { UploadOutlined } from '@ant-design/icons';
2 | import type { UploadProps } from 'antd';
3 | import { Button, message, Upload } from 'antd';
4 | import React from 'react';
5 |
6 | import type { ComponentDemo } from '../../../interface';
7 |
8 | const props: UploadProps = {
9 | name: 'file',
10 | action: 'https://www.mocky.io/v2/5cc8019d300000980a055e76',
11 | headers: { authorization: 'authorization-text' },
12 | onChange(info) {
13 | if (info.file.status === 'done') {
14 | message.success(`${info.file.name} file uploaded successfully`);
15 | } else if (info.file.status === 'error') {
16 | message.error(`${info.file.name} file upload failed.`);
17 | }
18 | },
19 | };
20 | const Demo = () => (
21 |
22 | }>Click to Upload
23 |
24 | );
25 |
26 | const componentDemo: ComponentDemo = {
27 | demo: ,
28 | tokens: ['colorPrimary', 'colorPrimaryHover', 'colorPrimaryActive'],
29 | key: 'upload',
30 | };
31 |
32 | export default componentDemo;
33 |
--------------------------------------------------------------------------------
/src/previews/overviews/Error.tsx:
--------------------------------------------------------------------------------
1 | import { Flexbox } from '@arvinxu/layout-kit';
2 | import { Card } from 'antd';
3 | import React from 'react';
4 |
5 | import Alert from '../components/alert/error';
6 | import Badge from '../components/badge/badge';
7 | import Button from '../components/button/dangerButton';
8 | import Dropdown from '../components/dropdown/dropdownError';
9 | import Menu from '../components/menu/menuDanger';
10 | import Message from '../components/message/error';
11 | import Notification from '../components/notification/error';
12 | import Progress from '../components/progress/danger';
13 | import Tag from '../components/tag/error';
14 | import Timeline from '../components/timeline/danger';
15 | import Upload from '../components/upload/danger';
16 |
17 | export const Error = ({ id }: { id?: string }) => {
18 | return (
19 |
20 |
21 |
22 |
28 | {Button.demo}
29 | {Tag.demo}
30 | {Badge.demo}
31 |
32 | {Alert.demo}
33 |
34 |
35 | {Message.demo}
36 | {Progress.demo}
37 |
38 |
39 |
40 | {Notification.demo}
41 | {Timeline.demo}
42 |
43 |
44 | {Menu.demo}
45 | {Upload.demo}
46 | {Dropdown.demo}
47 |
48 |
49 | );
50 | };
51 |
--------------------------------------------------------------------------------
/src/previews/overviews/Primary.tsx:
--------------------------------------------------------------------------------
1 | import { Card, Space } from 'antd';
2 | import React from 'react';
3 |
4 | import Button from '../components/button/button-icon';
5 | import Checkbox from '../components/checkbox/checkbox';
6 | import Menu from '../components/menu/menu';
7 | import Pagination from '../components/pagination/outline';
8 | import Popconfirm from '../components/popconfirm/popconfirm';
9 | import RadioButton from '../components/radio/button';
10 | import Radio from '../components/radio/radio';
11 | import SelectTag from '../components/select/selectTag';
12 | import Steps from '../components/steps/steps';
13 | import Switch from '../components/switch/switch';
14 | import Table from '../components/table/table';
15 | import Tabs from '../components/tabs/tabs';
16 | import Timeline from '../components/timeline/timeline';
17 |
18 | export const Primary = ({ id }: { id?: string }) => {
19 | return (
20 |
21 |
22 |
23 | {Menu.demo}
24 |
25 |
26 |
27 | {Button.demo}
28 |
29 | {Radio.demo}
30 | {Checkbox.demo}
31 | {Switch.demo}
32 |
33 | {RadioButton.demo}
34 | {Tabs.demo}
35 |
36 | {SelectTag.demo}
37 |
38 | {Pagination.demo}
39 | {Steps.demo}
40 |
41 | {Popconfirm.demo}
42 | {Timeline.demo}
43 |
44 |
45 |
46 | {Table.demo}
47 |
48 |
49 | );
50 | };
51 |
--------------------------------------------------------------------------------
/src/previews/overviews/Success.tsx:
--------------------------------------------------------------------------------
1 | import { Card } from 'antd';
2 | import React from 'react';
3 |
4 | import Alert from '../components/alert/success';
5 | import Input from '../components/input/success';
6 | import Message from '../components/message/success';
7 | import Notification from '../components/notification/success';
8 | import Progress from '../components/progress/success';
9 | import Result from '../components/result/success';
10 | import Tag from '../components/tag/success';
11 | import Timeline from '../components/timeline/success';
12 |
13 | import { Flexbox } from '@arvinxu/layout-kit';
14 |
15 | export const Success = ({ id }: { id?: string }) => {
16 | return (
17 |
18 |
19 |
20 |
21 | {Tag.demo}
22 | {Input.demo}
23 |
24 | {Alert.demo}
25 |
26 |
27 | {Message.demo}
28 | {Progress.demo}
29 |
30 |
31 |
32 | {Notification.demo}
33 | {Timeline.demo}
34 |
35 | {Result.demo}
36 |
37 | );
38 | };
39 |
--------------------------------------------------------------------------------
/src/previews/overviews/Warning.tsx:
--------------------------------------------------------------------------------
1 | import { Card } from 'antd';
2 | import React from 'react';
3 |
4 | import Alert from '../components/alert/warning';
5 | import Badge from '../components/badge/warning';
6 | import Input from '../components/input/warning';
7 | import Message from '../components/message/warning';
8 | import Modal from '../components/modal/warning';
9 | import Notification from '../components/notification/warning';
10 | import Popconfirm from '../components/popconfirm/popconfirm';
11 | import Result from '../components/result/warning';
12 | import Tag from '../components/tag/warning';
13 | import Text from '../components/typography/warningText';
14 | import Title from '../components/typography/warningTitle';
15 |
16 | import { Flexbox } from '@arvinxu/layout-kit';
17 |
18 | export const Warning = ({ id }: { id?: string }) => {
19 | return (
20 |
21 |
22 |
23 |
24 | {Title.demo}
25 | {Input.demo}
26 |
27 | {Alert.demo}
28 |
29 |
30 | {Message.demo}
31 | {Popconfirm.demo}
32 |
33 | {Badge.demo}
34 | {Tag.demo}
35 | {Text.demo}
36 |
37 |
38 |
39 |
40 | {Notification.demo}
41 | {Modal.demo}
42 |
43 | {Result.demo}
44 |
45 | );
46 | };
47 |
--------------------------------------------------------------------------------
/src/previews/overviews/index.ts:
--------------------------------------------------------------------------------
1 | export * from './Error';
2 | export * from './Primary';
3 | export * from './Success';
4 | export * from './Warning';
5 |
--------------------------------------------------------------------------------
/src/token-panel-pro/InputNumberPlus.tsx:
--------------------------------------------------------------------------------
1 | import { InputNumber, Slider } from 'antd';
2 | import type { FC } from 'react';
3 | import React from 'react';
4 |
5 | export type InputNumberPlusProps = {
6 | value?: number;
7 | onChange?: (value: number | null) => void;
8 | min?: number;
9 | max?: number;
10 | style?: React.CSSProperties;
11 | };
12 |
13 | const InputNumberPlus: FC = ({
14 | value,
15 | onChange,
16 | min,
17 | max,
18 | style,
19 | }) => {
20 | return (
21 |
22 |
29 |
36 |
37 | );
38 | };
39 |
40 | export default InputNumberPlus;
41 |
--------------------------------------------------------------------------------
/src/token-panel-pro/ResetTokenButton.tsx:
--------------------------------------------------------------------------------
1 | import { Typography } from 'antd';
2 | import type { FC } from 'react';
3 | import React from 'react';
4 | import type { MutableTheme } from '../interface';
5 | import { useLocale } from '../locale';
6 |
7 | export type ResetTokenButtonProps = {
8 | theme: MutableTheme;
9 | tokenName: string;
10 | style?: React.CSSProperties;
11 | };
12 | const ResetTokenButton: FC = ({
13 | theme,
14 | tokenName,
15 | style,
16 | }) => {
17 | const locale = useLocale();
18 | const showReset = (theme.config.token as any)?.[tokenName];
19 | return (
20 |
21 | theme.onAbort?.(['token', tokenName])}
29 | >
30 | {locale.reset}
31 |
32 |
33 | );
34 | };
35 |
36 | export default ResetTokenButton;
37 |
--------------------------------------------------------------------------------
/src/utils/classifyToken.ts:
--------------------------------------------------------------------------------
1 | import type { GlobalToken } from 'antd/es/theme/interface';
2 | import type { TokenValue } from '../interface';
3 |
4 | function defineTokenType(types: T[]) {
5 | return types;
6 | }
7 |
8 | export const TOKEN_SORTS = defineTokenType([
9 | 'seed',
10 | 'colorCommon',
11 | 'colorText',
12 | 'colorBg',
13 | 'colorFill',
14 | 'colorSplit',
15 | 'font',
16 | 'radius',
17 | 'space',
18 | 'screen',
19 | 'line',
20 | 'motion',
21 | 'control',
22 | 'others',
23 | ]);
24 |
25 | export type TokenType = typeof TOKEN_SORTS[number];
26 |
27 | export function getTypeOfToken(tokenName: string): TokenType {
28 | if (tokenName.startsWith('color')) {
29 | if (
30 | tokenName.startsWith('colorLink') ||
31 | tokenName.startsWith('colorText') ||
32 | tokenName.startsWith('colorIcon') ||
33 | tokenName.startsWith('colorPlaceholder') ||
34 | tokenName.startsWith('colorIcon')
35 | ) {
36 | return 'colorText';
37 | }
38 | if (
39 | tokenName.startsWith('colorBg') ||
40 | tokenName.startsWith('colorPopupBg')
41 | ) {
42 | return 'colorBg';
43 | }
44 | if (
45 | tokenName.startsWith('colorBorder') ||
46 | tokenName.startsWith('colorSplit')
47 | ) {
48 | return 'colorSplit';
49 | }
50 | if (tokenName.startsWith('colorFill')) {
51 | return 'colorFill';
52 | }
53 | return 'colorCommon';
54 | }
55 | if (tokenName.startsWith('font')) {
56 | return 'font';
57 | }
58 | if (tokenName.startsWith('screen')) {
59 | return 'screen';
60 | }
61 | if (tokenName.startsWith('line')) {
62 | return 'line';
63 | }
64 | if (tokenName.startsWith('motion')) {
65 | return 'motion';
66 | }
67 | if (tokenName.startsWith('borderRadius')) {
68 | return 'radius';
69 | }
70 | if (tokenName.startsWith('control')) {
71 | return 'control';
72 | }
73 | if (tokenName.startsWith('margin') || tokenName.startsWith('padding')) {
74 | return 'space';
75 | }
76 | return 'others';
77 | }
78 |
79 | export const classifyToken = (
80 | token: Record,
81 | ): Record => {
82 | const groupedToken: Record = {};
83 | Object.keys(token || {})
84 | .sort((a, b) => a.localeCompare(b))
85 | .forEach((key) => {
86 | const type = getTypeOfToken(key as keyof GlobalToken);
87 | if (!groupedToken[type]) {
88 | groupedToken[type] = [];
89 | }
90 | groupedToken[type].push(key);
91 | });
92 | return groupedToken;
93 | };
94 |
--------------------------------------------------------------------------------
/src/utils/constants.ts:
--------------------------------------------------------------------------------
1 | export const HIGHLIGHT_COLOR = '#FF5500';
2 |
--------------------------------------------------------------------------------
/src/utils/deepUpdateObj.ts:
--------------------------------------------------------------------------------
1 | const deepUpdateObj = (obj: any, path: string[], value: any): any => {
2 | if (path.length === 0) {
3 | return obj;
4 | }
5 | if (path.length === 1) {
6 | if (value === null || value === undefined) {
7 | const newObj = { ...obj };
8 | delete newObj[path[0]];
9 | return newObj;
10 | }
11 | return {
12 | ...obj,
13 | [path[0]]: value,
14 | };
15 | }
16 |
17 | const pathValue = deepUpdateObj(obj[path[0]] ?? {}, path.slice(1), value);
18 | if (
19 | pathValue === null ||
20 | pathValue === undefined ||
21 | Object.keys(pathValue).length === 0
22 | ) {
23 | const newObj = { ...obj };
24 | delete newObj[path[0]];
25 | return newObj;
26 | }
27 | return {
28 | ...obj,
29 | [path[0]]: pathValue,
30 | };
31 | };
32 |
33 | export default deepUpdateObj;
34 |
--------------------------------------------------------------------------------
/src/utils/getColorBgImg.ts:
--------------------------------------------------------------------------------
1 | const getColorBgImg = (dark?: boolean) => {
2 | return dark
3 | ? 'url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAIAAAD8GO2jAAAABGdBTUEAALGPC/xhBQAAADhlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAAqACAAQAAAABAAAAIKADAAQAAAABAAAAIAAAAACPTkDJAAAAZUlEQVRIDe2VMQoAMAgDa9/g/1/oIzrpZBCh2dLFkkoDF0Fz99OdiOjks+2/7S8fRRmMMIVoRGSoYzvvqF8ZIMKlC1GhQBc6IkPzq32QmdAzkEGihpWOSPsAss8HegYySNSw0hE9WQ4StafZFqkAAAAASUVORK5CYII=)'
4 | : 'url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAAFpJREFUWAntljEKADAIA23p6v//qQ+wfUEcCu1yriEgp0FHRJSJcnehmmWm1Dv/lO4HIg1AAAKjTqm03ea88zMCCEDgO4HV5bS757f+7wRoAAIQ4B9gByAAgQ3pfiDmXmAeEwAAAABJRU5ErkJggg==)';
5 | };
6 |
7 | export default getColorBgImg;
8 |
--------------------------------------------------------------------------------
/src/utils/getDesignToken.ts:
--------------------------------------------------------------------------------
1 | import type { ThemeConfig } from 'antd/es/config-provider/context';
2 | import type { GlobalToken, MapToken } from 'antd/es/theme/interface';
3 | import defaultMap from 'antd/es/theme/themes/default';
4 | import seed from 'antd/es/theme/themes/seed';
5 | import formatToken from 'antd/es/theme/util/alias';
6 |
7 | export default function getDesignToken(config: ThemeConfig = {}): GlobalToken {
8 | const seedToken = { ...seed, ...config.token };
9 | const mapFn = config.algorithm ?? defaultMap;
10 | const mapToken = Array.isArray(mapFn)
11 | ? mapFn.reduce(
12 | (result, fn) => fn(seedToken, result),
13 | undefined as any,
14 | )
15 | : mapFn(seedToken);
16 | const mergedMapToken = {
17 | ...mapToken,
18 | ...config.components,
19 | override: config.token ?? {},
20 | };
21 | return formatToken(mergedMapToken);
22 | }
23 |
--------------------------------------------------------------------------------
/src/utils/getValueByPath.ts:
--------------------------------------------------------------------------------
1 | export default function getValueByPath(obj: any, path: string[]): any {
2 | if (!obj) {
3 | return undefined;
4 | }
5 | return path.reduce((prev, key) => {
6 | if (prev) {
7 | return prev[key];
8 | }
9 | return undefined;
10 | }, obj);
11 | }
12 |
--------------------------------------------------------------------------------
/src/utils/isColor.ts:
--------------------------------------------------------------------------------
1 | export default function isColor(str: string) {
2 | return (
3 | typeof str === 'string' && (str.startsWith('rgb') || str.startsWith('#'))
4 | );
5 | }
6 |
--------------------------------------------------------------------------------
/src/utils/makeStyle.tsx:
--------------------------------------------------------------------------------
1 | import type { CSSInterpolation } from '@ant-design/cssinjs';
2 | import { useStyleRegister } from '@ant-design/cssinjs';
3 | import { ConfigProvider, theme as antdTheme } from 'antd';
4 | import type { GlobalToken } from 'antd/es/theme/interface';
5 | import { useContext } from 'react';
6 |
7 | const { ConfigContext } = ConfigProvider;
8 |
9 | export type ThemeEditorToken = GlobalToken & {
10 | rootCls: string;
11 | componentCls: string;
12 | headerHeight: number;
13 | };
14 |
15 | const makeStyle =
16 | (
17 | path: string,
18 | styleFn: (token: ThemeEditorToken) => CSSInterpolation,
19 | ): ((
20 | prefixCls?: string,
21 | ) => string) =>
22 | (prefixCls) => {
23 | const { theme, token, hashId } = antdTheme.useToken();
24 | const { getPrefixCls } = useContext(ConfigContext);
25 | const rootCls = getPrefixCls();
26 |
27 | useStyleRegister(
28 | { theme: theme as any, hashId, token, path: [path, prefixCls || ''] },
29 | () =>
30 | styleFn({
31 | ...token,
32 | rootCls: `.${rootCls}`,
33 | componentCls: `.${prefixCls}`,
34 | headerHeight: 56,
35 | }),
36 | )
37 |
38 | return hashId;
39 | };
40 |
41 | export default makeStyle;
42 |
--------------------------------------------------------------------------------
/src/utils/parse-config.ts:
--------------------------------------------------------------------------------
1 | import type { ThemeConfig } from 'antd';
2 | import { theme } from 'antd';
3 |
4 | export type Algorithm = 'dark' | 'compact';
5 |
6 | export interface PlainThemeConfig extends Omit {
7 | algorithm?: Algorithm | Algorithm[];
8 | }
9 |
10 | export const algorithmMap: {
11 | [key in Algorithm]: typeof theme.darkAlgorithm;
12 | } = {
13 | dark: theme.darkAlgorithm,
14 | compact: theme.compactAlgorithm,
15 | };
16 |
17 | export const getAlgorithmString = (algorithm: typeof theme.darkAlgorithm) => {
18 | return Object.entries(algorithmMap).find(
19 | ([, value]) => value === algorithm,
20 | )?.[0] as Algorithm;
21 | };
22 |
23 | export const parsePlainConfig = (config: ThemeConfig): PlainThemeConfig => {
24 | const { algorithm, ...rest } = config;
25 | if (!algorithm) return rest;
26 |
27 | const parsedAlgorithms = Array.isArray(algorithm)
28 | ? algorithm.map(getAlgorithmString)
29 | : getAlgorithmString(algorithm);
30 | return {
31 | ...rest,
32 | algorithm: parsedAlgorithms,
33 | };
34 | };
35 |
36 | export const parseThemeConfig = (config: PlainThemeConfig): ThemeConfig => {
37 | const { algorithm, ...rest } = config;
38 | if (!algorithm) return rest;
39 |
40 | const parsedAlgorithms = Array.isArray(algorithm)
41 | ? algorithm.map((item) => algorithmMap[item]).filter(Boolean)
42 | : algorithmMap[algorithm];
43 | return {
44 | ...rest,
45 | algorithm: parsedAlgorithms,
46 | };
47 | };
48 |
--------------------------------------------------------------------------------
/src/utils/statistic.ts:
--------------------------------------------------------------------------------
1 | import tokenStatistic from 'antd/es/version/token.json';
2 |
3 | const tokenRelatedComponents: {
4 | [key in string]?: string[];
5 | } = {};
6 |
7 | const getRelatedComponentsSingle = (token: string): string[] => {
8 | if (!tokenRelatedComponents[token]) {
9 | tokenRelatedComponents[token] = Object.entries(tokenStatistic)
10 | .filter(([, tokens]) => {
11 | return (tokens.global as string[]).includes(token);
12 | })
13 | .map(([component]) => component);
14 | }
15 | return tokenRelatedComponents[token] ?? [];
16 | };
17 |
18 | export const getRelatedComponents = (token: string | string[]): string[] => {
19 | const mergedTokens = Array.isArray(token) ? token : [token];
20 | return Array.from(
21 | new Set(
22 | mergedTokens.reduce((result, item) => {
23 | return result.concat(getRelatedComponentsSingle(item));
24 | }, []),
25 | ),
26 | );
27 | };
28 |
29 | export const getComponentToken = (component: string) =>
30 | (tokenStatistic as any)[component];
31 |
--------------------------------------------------------------------------------
/tests/TokenInput.test.tsx:
--------------------------------------------------------------------------------
1 | import { fireEvent, render } from '@testing-library/react';
2 | import React from 'react';
3 | import TokenInput from '../src/TokenInput';
4 |
5 | describe('TokenInput', () => {
6 | it('reset btn should display correctly', () => {
7 | const { container } = render( );
8 | expect(
9 | container.querySelector('.ant-input-group-addon > span > button'),
10 | ).toBeFalsy();
11 | fireEvent.change(container.querySelector('input')!, {
12 | target: { value: 'newVal' },
13 | });
14 |
15 | expect(
16 | container.querySelector('.ant-input-group-addon > span > button'),
17 | ).toBeTruthy();
18 | });
19 | });
20 |
--------------------------------------------------------------------------------
/tests/utils.test.tsx:
--------------------------------------------------------------------------------
1 | import { render } from '@testing-library/react';
2 | import { ConfigProvider, theme } from 'antd';
3 | import { getDesignToken } from 'antd-token-previewer';
4 | import type { ThemeConfig } from 'antd/es/config-provider/context';
5 | import React from 'react';
6 | import getValueByPath from '../src/utils/getValueByPath';
7 |
8 | const { useToken, darkAlgorithm } = theme;
9 |
10 | describe('Utils', () => {
11 | describe('getValueByPath', () => {
12 | it('should work', () => {
13 | const obj = {
14 | a: {
15 | b: {
16 | c: 'c',
17 | },
18 | },
19 | };
20 | expect(getValueByPath(obj, ['a', 'b', 'c'])).toBe('c');
21 | });
22 |
23 | it('should return null when path is not exist', () => {
24 | expect(getValueByPath({}, ['a', 'b'])).toBeUndefined();
25 | });
26 |
27 | it('null object should return null', () => {
28 | expect(getValueByPath(null, ['a', 'b'])).toBeUndefined();
29 | });
30 | });
31 |
32 | it('getDesignToken should be consistent with useToken', () => {
33 | const themeConfig: ThemeConfig = {
34 | token: {
35 | colorPrimary: '#f5f5',
36 | colorLink: '#66ccff',
37 | },
38 | algorithm: darkAlgorithm,
39 | };
40 | let tokenFromHook;
41 |
42 | const Component = () => {
43 | const { token } = useToken();
44 | tokenFromHook = token;
45 | delete (tokenFromHook as any)._hashId;
46 | delete (tokenFromHook as any)._tokenKey;
47 | return null;
48 | };
49 |
50 | render(
51 |
52 |
53 | ,
54 | );
55 | expect(getDesignToken(themeConfig)).toStrictEqual(tokenFromHook);
56 | });
57 | });
58 |
--------------------------------------------------------------------------------
/tests/utils/setup.js:
--------------------------------------------------------------------------------
1 | if (!window.matchMedia) {
2 | Object.defineProperty(global.window, 'matchMedia', {
3 | value: jest.fn((query) => ({
4 | matches: query.includes('max-width'),
5 | addListener: jest.fn(),
6 | removeListener: jest.fn(),
7 | })),
8 | });
9 | }
10 |
--------------------------------------------------------------------------------
/tests/utils/setupAfterEnv.ts:
--------------------------------------------------------------------------------
1 | jest.mock('antd', () => {
2 | const antd = jest.requireActual('antd');
3 | antd.theme.defaultConfig.hashed = false;
4 |
5 | return antd;
6 | });
7 |
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "esnext",
4 | "module": "ESNext",
5 | "moduleResolution": "node",
6 | "baseUrl": "./",
7 | "lib": ["dom", "es2017"],
8 | "jsx": "react",
9 | "strict": true,
10 | "esModuleInterop": true,
11 | "experimentalDecorators": true,
12 | "emitDecoratorMetadata": true,
13 | "resolveJsonModule": true,
14 | "skipLibCheck": true,
15 | "declaration": true,
16 | "paths": {
17 | "antd-token-previewer": ["src/index.tsx"]
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/type.d.ts:
--------------------------------------------------------------------------------
1 | declare module '*.css';
2 |
3 | declare module '*.less';
4 |
--------------------------------------------------------------------------------