diff --git a/.dumi/theme/builtins/Palette/index.tsx b/.dumi/theme/builtins/Palette/index.tsx index b94369dd0b0a..4dacea1bc6ba 100644 --- a/.dumi/theme/builtins/Palette/index.tsx +++ b/.dumi/theme/builtins/Palette/index.tsx @@ -1,4 +1,3 @@ -// @ts-ignore import Palette from '../../common/Color/Palette'; export default Palette; diff --git a/.dumi/theme/builtins/Previewer/fromDumiProps.tsx b/.dumi/theme/builtins/Previewer/fromDumiProps.tsx index f00d5872f591..435a9035f629 100644 --- a/.dumi/theme/builtins/Previewer/fromDumiProps.tsx +++ b/.dumi/theme/builtins/Previewer/fromDumiProps.tsx @@ -3,7 +3,6 @@ import React, { useEffect, useState } from 'react'; import JsonML from 'jsonml.js/lib/utils'; // @ts-ignore import toReactComponent from 'jsonml-to-react-element'; -// @ts-ignore import Prism from 'prismjs'; import { useLocation, useIntl, type IPreviewerProps } from 'dumi'; import { ping } from '../../utils'; diff --git a/.dumi/theme/common/BrowserFrame.jsx b/.dumi/theme/common/BrowserFrame.jsx deleted file mode 100644 index 642e372890fb..000000000000 --- a/.dumi/theme/common/BrowserFrame.jsx +++ /dev/null @@ -1,5 +0,0 @@ -import React from 'react'; - -const BrowserFrame = ({ children }) =>
Basic usage (deprecated syntactic sugar)
Basic
Placement
Arrow
diff --git a/components/dropdown/index.zh-CN.md b/components/dropdown/index.zh-CN.md
index dacfd68b6494..c3802662cd1c 100644
--- a/components/dropdown/index.zh-CN.md
+++ b/components/dropdown/index.zh-CN.md
@@ -17,40 +17,9 @@ demo:
- 用于收罗一组命令操作。
- Select 用于选择,而 Dropdown 是命令集合。
-### 4.24.0 用法升级
-
-基础用法(废弃的语法糖)
基本
弹出位置
箭头
diff --git a/components/float-button/style/index.tsx b/components/float-button/style/index.tsx
index ce82dfdf7b8b..05d391d84618 100644
--- a/components/float-button/style/index.tsx
+++ b/components/float-button/style/index.tsx
@@ -80,7 +80,7 @@ const initFloatButtonGroupMotion = (token: FloatButtonToken) => {
// ============================== Group ==============================
const floatButtonGroupStyle: GenerateStylelong content
- { - // indicates very long content - Array.from({ length: 100 }, (_, index) => ( -long content
+ { + // indicates very long content + Array.from({ length: 100 }, (_, index) => ( +Basic usage (deprecated syntactic sugar)
Top Navigation
Inline menu
Collapsed inline menu
@@ -108,25 +78,6 @@ The legacy demo code for version `<4.20.0` could be found at [https://github.com
| label | Menu label | ReactNode | - | |
| title | Set display title for collapsed item | string | - | |
-> Note: `icon` is a newly added prop in `4.2.0`. For previous versions, please use the following method to define the icon.
->
-> ```jsx
-> 基础用法(废弃的语法糖)
顶部导航
内嵌菜单
缩起内嵌菜单
@@ -109,25 +79,6 @@ return ;
| label | 菜单项标题 | ReactNode | - | |
| title | 设置收缩时展示的悬浮标题 | string | - | |
-> 注意:`icon` 是 `4.2.0` 新增的属性,之前的版本请使用下面的方式定义图标。
->
-> ```jsx
-> Custom modal content render
To customize the width of modal
\_InternalPanelDoNotUseOrYouWillBeFired
-控制弹框动画原点
+Control modal's animation origin position
+Wireframe
## API
@@ -97,6 +98,7 @@ The items listed above are all functions, expecting a settings object as paramet
| closable | Whether a close (x) button is visible on top right of the confirm dialog or not | boolean | false | 4.9.0 |
| closeIcon | Custom close icon | ReactNode | undefined | 4.9.0 |
| content | Content | ReactNode | - | |
+| footer | Footer content, set as `footer: null` when you don't need default buttons | ReactNode | - | 5.1.0 |
| getContainer | Return the mount node for Modal | HTMLElement \| () => HTMLElement \| Selectors \| false | document.body | |
| icon | Custom icon | ReactNode | <QuestionCircle /> | |
| keyboard | Whether support press esc to close | boolean | true | |
diff --git a/components/modal/index.zh-CN.md b/components/modal/index.zh-CN.md
index 071abebbb4bf..2f700f388a68 100644
--- a/components/modal/index.zh-CN.md
+++ b/components/modal/index.zh-CN.md
@@ -34,7 +34,8 @@ demo:
自定义渲染对话框
自定义模态的宽度
\_InternalPanelDoNotUseOrYouWillBeFired
-control modal's animation origin position
+控制弹框动画原点
+线框风格
## API
@@ -100,6 +101,7 @@ demo:
| closable | 是否显示右上角的关闭按钮 | boolean | false | 4.9.0 |
| closeIcon | 自定义关闭图标 | ReactNode | undefined | 4.9.0 |
| content | 内容 | ReactNode | - | |
+| footer | 底部内容,当不需要默认底部按钮时,可以设为 `footer: null` | ReactNode | - | 5.1.0 |
| getContainer | 指定 Modal 挂载的 HTML 节点, false 为挂载在当前 dom | HTMLElement \| () => HTMLElement \| Selectors \| false | document.body | |
| icon | 自定义图标 | ReactNode | <QuestionCircle /> | |
| keyboard | 是否支持键盘 esc 关闭 | boolean | true | |
diff --git a/components/pagination/__tests__/__snapshots__/demo-extend.test.ts.snap b/components/pagination/__tests__/__snapshots__/demo-extend.test.ts.snap
index f4fe028d69b4..05a8a8d2261f 100644
--- a/components/pagination/__tests__/__snapshots__/demo-extend.test.ts.snap
+++ b/components/pagination/__tests__/__snapshots__/demo-extend.test.ts.snap
@@ -4493,3 +4493,718 @@ Array [
,
]
`;
+
+exports[`renders ./components/pagination/demo/wireframe.tsx extend context correctly 1`] = `
+Array [
+ Total number
Show All
Prev and next
+Wireframe
## API
diff --git a/components/pagination/index.zh-CN.md b/components/pagination/index.zh-CN.md
index f124d7c3cde1..b4a03d1c5ddc 100644
--- a/components/pagination/index.zh-CN.md
+++ b/components/pagination/index.zh-CN.md
@@ -26,6 +26,7 @@ cover: https://mdn.alipayobjects.com/huamei_7uahnr/afts/img/A*8y_iTJGY_aUAAAAAAA
总数
全部展示
上一步和下一步
+线框风格
## API
diff --git a/components/popconfirm/PurePanel.tsx b/components/popconfirm/PurePanel.tsx
index 6c9f25c3a1f6..9fb6bedee322 100644
--- a/components/popconfirm/PurePanel.tsx
+++ b/components/popconfirm/PurePanel.tsx
@@ -116,8 +116,7 @@ export default function PurePanel(props: PurePanelProps) {
placement={placement}
className={classNames(prefixCls, className)}
style={style}
- >
- Asynchronously close
Asynchronously close on Promise
_InternalPanelDoNotUseOrYouWillBeFired
+Wireframe
## API
diff --git a/components/popconfirm/index.tsx b/components/popconfirm/index.tsx
index 3c64fc60f4f3..b33085e00ef0 100644
--- a/components/popconfirm/index.tsx
+++ b/components/popconfirm/index.tsx
@@ -3,6 +3,7 @@ import classNames from 'classnames';
import useMergedState from 'rc-util/lib/hooks/useMergedState';
import KeyCode from 'rc-util/lib/KeyCode';
import * as React from 'react';
+import omit from 'rc-util/lib/omit';
import type { ButtonProps, LegacyButtonType } from '../button/button';
import { ConfigContext } from '../config-provider';
import Popover from '../popover';
@@ -10,7 +11,6 @@ import type { AbstractTooltipProps } from '../tooltip';
import type { RenderFunction } from '../_util/getRenderPropValue';
import { cloneElement } from '../_util/reactNode';
import PurePanel, { Overlay } from './PurePanel';
-
import usePopconfirmStyle from './style';
export interface PopconfirmProps extends AbstractTooltipProps {
@@ -95,14 +95,14 @@ const Popconfirm = React.forwardRef基于 Promise 的异步关闭
_InternalPanelDoNotUseOrYouWillBeFired
+线框风格
## API
diff --git a/components/popover/__tests__/__snapshots__/demo-extend.test.ts.snap b/components/popover/__tests__/__snapshots__/demo-extend.test.ts.snap
index 26071b35cb93..61409fa7d067 100644
--- a/components/popover/__tests__/__snapshots__/demo-extend.test.ts.snap
+++ b/components/popover/__tests__/__snapshots__/demo-extend.test.ts.snap
@@ -1130,3 +1130,76 @@ exports[`renders ./components/popover/demo/triggerType.tsx extend context correc
`;
+
+exports[`renders ./components/popover/demo/wireframe.tsx extend context correctly 1`] = `
+Array [
+ + Content +
++ Content +
++ Content +
++ Content +
++ Content +
++ Content +
++ Content +
++ Content +
+Content
+Content
+Arrow pointing
Hover with click popover
_InternalPanelDoNotUseOrYouWillBeFired
+Wireframe
## API
diff --git a/components/popover/index.tsx b/components/popover/index.tsx
index b655890d2456..8112324070f7 100644
--- a/components/popover/index.tsx
+++ b/components/popover/index.tsx
@@ -13,8 +13,6 @@ import useStyle from './style';
export interface PopoverProps extends AbstractTooltipProps {
title?: React.ReactNode | RenderFunction;
content?: React.ReactNode | RenderFunction;
- /** @internal Used For Popconfirm. Safe to remove. */
- _overlay?: React.ReactNode;
}
interface OverlayPorps {
@@ -41,7 +39,6 @@ const Popover = React.forwardRef箭头指向
悬停点击弹出窗口
_InternalPanelDoNotUseOrYouWillBeFired
+线框风格
## API
diff --git a/components/popover/style/index.tsx b/components/popover/style/index.tsx
index 6f5f250bc761..26d811b94f3e 100644
--- a/components/popover/style/index.tsx
+++ b/components/popover/style/index.tsx
@@ -36,7 +36,11 @@ const genBaseStyle: GenerateStyle+ QRCode is expired +
++ QRCode is expired +
+base
+With Icon
+other statu
+Custom Size
+Custom Color
+Download QRCode
+Error Level
+Advanced Usage
+
+## API
+
+> This component is available since `antd@5.1.0`
+
+| Property | Description | Type | Default |
+| :-- | :-- | :-- | :-- |
+| value | scanned link | string | - |
+| icon | include image url (only image link are supported) | string | - |
+| size | QRCode size | number | 128 |
+| iconSize | include image size | number | 32 |
+| color | QRCode Color | string | `#000` |
+| bordered | Whether has border style | boolean | `true` |
+| errorLevel | Error Code Level | `'L' \| 'M' \| 'Q' \| 'H' ` | `M` |
+| status | QRCode statu | `active \| expired \| loading ` | `active` |
+| onRefresh | callback | `() => void` | - |
+
+## FAQ
+
+### About QRCode ErrorLevel
+
+The ErrorLevel means that the QR code can be scanned normally after being blocked, and the maximum area that can be blocked is the error correction rate.
+
+Generally, the QR code is divided into 4 error correction levels: Level `L` can correct about `7%` errors, Level `M` can correct about `15%` errors, Level `Q` can correct about `25%` errors, and Level `H` can correct about `30%` errors. When the content encoding of the QR code carries less information, in other words, when the value link is short, set different error correction levels, and the generated image will not change.
+
+> For more information, see the: [https://www.qrcode.com/en/about/error_correction](https://www.qrcode.com/en/about/error_correction.html)
diff --git a/components/qrcode/index.tsx b/components/qrcode/index.tsx
new file mode 100644
index 000000000000..b47d7da9288f
--- /dev/null
+++ b/components/qrcode/index.tsx
@@ -0,0 +1,100 @@
+import React, { useMemo, useContext } from 'react';
+import { QRCodeCanvas } from 'qrcode.react';
+import classNames from 'classnames';
+import { ReloadOutlined } from '@ant-design/icons';
+import { ConfigContext } from '../config-provider';
+import LocaleReceiver from '../locale-provider/LocaleReceiver';
+import type { ConfigConsumerProps } from '../config-provider';
+import type { QRCodeProps, QRPropsCanvas } from './interface';
+import warning from '../_util/warning';
+import useStyle from './style/index';
+import Spin from '../spin';
+import Button from '../button';
+import theme from '../theme';
+
+const { useToken } = theme;
+
+const QRCode: React.FC{locale.expired}
+ {typeof onRefresh === 'function' && ( +基本使用
+带 Icon 的例子
+不同的状态
+自定义尺寸
+自定义颜色
+下载二维码
+纠错比例
+高级用法
+
+## API
+
+> 自 `antd@5.1.0` 版本开始提供该组件。
+
+| 参数 | 说明 | 类型 | 默认值 |
+| :-- | :-- | :-- | :-- |
+| value | 扫描后的地址 | string | - |
+| icon | 二维码中图片的地址(目前只支持图片地址) | string | - |
+| size | 二维码大小 | number | 160 |
+| iconSize | 二维码中图片的大小 | number | 40 |
+| color | 二维码颜色 | string | `#000` |
+| bordered | 是否有边框 | boolean | `true` |
+| errorLevel | 二维码纠错等级 | `'L' \| 'M' \| 'Q' \| 'H' ` | `M` |
+| status | 二维码状态 | `active \| expired \| loading ` | `active` |
+| onRefresh | 点击"点击刷新"的回调 | `() => void` | - |
+
+## FAQ
+
+### 关于二维码纠错等级
+
+纠错等级也叫纠错率,就是指二维码可以被遮挡后还能正常扫描,而这个能被遮挡的最大面积就是纠错率。
+
+通常情况下二维码分为 4 个纠错级别:`L级` 可纠正约 `7%` 错误、`M级` 可纠正约 `15%` 错误、`Q级` 可纠正约 `25%` 错误、`H级` 可纠正约`30%` 错误。并不是所有位置都可以缺损,像最明显的三个角上的方框,直接影响初始定位。中间零散的部分是内容编码,可以容忍缺损。当二维码的内容编码携带信息比较少的时候,也就是链接比较短的时候,设置不同的纠错等级,生成的图片不会发生变化。
+
+> 有关更多信息,可参阅相关资料:[https://www.qrcode.com/zh/about/error_correction](https://www.qrcode.com/zh/about/error_correction.html)
diff --git a/components/qrcode/interface.ts b/components/qrcode/interface.ts
new file mode 100644
index 000000000000..bebeeacd78aa
--- /dev/null
+++ b/components/qrcode/interface.ts
@@ -0,0 +1,32 @@
+import type { CSSProperties } from 'react';
+
+interface ImageSettings {
+ src: string;
+ height: number;
+ width: number;
+ excavate: boolean;
+ x?: number;
+ y?: number;
+}
+
+interface QRProps {
+ value: string;
+ size?: number;
+ color?: string;
+ style?: CSSProperties;
+ includeMargin?: boolean;
+ imageSettings?: ImageSettings;
+}
+
+export type QRPropsCanvas = QRProps & React.CanvasHTMLAttributesRadio.Group with name
Size
Solid radio button
-测试 Badge 的样式
+Badge style
+Wireframe
## API
diff --git a/components/radio/index.zh-CN.md b/components/radio/index.zh-CN.md
index c86d251da49b..40eb8a145873 100644
--- a/components/radio/index.zh-CN.md
+++ b/components/radio/index.zh-CN.md
@@ -27,7 +27,8 @@ demo:
单选组合 - 配合 name 使用
大小
填底的按钮样式
-Badge style
+测试 Badge 的样式
+线框风格
## API
diff --git a/components/radio/radio.tsx b/components/radio/radio.tsx
index c4a8bf02fc45..85629d0af29f 100644
--- a/components/radio/radio.tsx
+++ b/components/radio/radio.tsx
@@ -2,7 +2,6 @@ import classNames from 'classnames';
import RcCheckbox from 'rc-checkbox';
import { composeRef } from 'rc-util/lib/ref';
import * as React from 'react';
-import { useContext } from 'react';
import { ConfigContext } from '../config-provider';
import DisabledContext from '../config-provider/DisabledContext';
import { FormItemInputContext } from '../form/context';
@@ -19,7 +18,7 @@ const InternalRadio: React.ForwardRefRenderFunctionBasic (deprecated syntactic sugar)
Basic
Mini version
With icon
@@ -49,6 +31,7 @@ return Progress Debug
Steps inside Steps
Inline Steps
+Wireframe
## API
diff --git a/components/steps/index.zh-CN.md b/components/steps/index.zh-CN.md
index ef9025c01642..da5d632b86eb 100644
--- a/components/steps/index.zh-CN.md
+++ b/components/steps/index.zh-CN.md
@@ -12,27 +12,9 @@ cover: https://mdn.alipayobjects.com/huamei_7uahnr/afts/img/A*677sTqCpE3wAAAAAAA
当任务复杂或者存在先后关系时,将其分解成一系列步骤,从而简化任务。
-### 4.24.0 用法升级
-
-基本用法 (废弃的语法糖)
基本用法
迷你版
带图标的步骤条
@@ -50,6 +32,7 @@ return Progress Debug
Steps 嵌套 Steps
内联步骤
+线框风格
## API
diff --git a/components/style/compact-item.tsx b/components/style/compact-item.tsx
index 8165934c8cb1..236c79391363 100644
--- a/components/style/compact-item.tsx
+++ b/components/style/compact-item.tsx
@@ -2,26 +2,40 @@
import type { CSSObject } from '@ant-design/cssinjs';
import type { DerivativeToken } from '../theme/internal';
+interface CompactItemOptions {
+ focus?: boolean;
+ /**
+ * Some component borders are implemented on child elements
+ * like `Select`
+ */
+ borderElCls?: string;
+ /**
+ * Some components have special `focus` className especially with popovers
+ * like `Select` and `DatePicker`
+ */
+ focusElCls?: string;
+}
+
// handle border collapse
-function compactItemBorder(
- token: DerivativeToken,
- borderedItemCls?: string,
- popoverFocusedCls?: string,
-): CSSObject {
- const childCombinator = borderedItemCls ? '> *' : '';
+function compactItemBorder(token: DerivativeToken, options: CompactItemOptions): CSSObject {
+ const childCombinator = options.borderElCls ? '> *' : '';
+ const hoverEffects = ['hover', options.focus ? 'focus' : null, 'active']
+ .filter(Boolean)
+ .map((n) => `&:${n} ${childCombinator}`)
+ .join(',');
return {
'&-item:not(&-last-item)': {
marginInlineEnd: -token.lineWidth,
},
'&-item': {
- [`&:hover ${childCombinator}, &:focus ${childCombinator}, &:active ${childCombinator}`]: {
+ [hoverEffects]: {
zIndex: 2,
},
- ...(popoverFocusedCls
+ ...(options.focusElCls
? {
- [`&${popoverFocusedCls}`]: {
+ [`&${options.focusElCls}`]: {
zIndex: 2,
},
}
@@ -35,8 +49,8 @@ function compactItemBorder(
}
// handle border-radius
-function compactItemBorderRadius(prefixCls: string, borderedElementCls?: string): CSSObject {
- const childCombinator = borderedElementCls ? `> ${borderedElementCls}` : '';
+function compactItemBorderRadius(prefixCls: string, options: CompactItemOptions): CSSObject {
+ const childCombinator = options.borderElCls ? `> ${options.borderElCls}` : '';
return {
[`&-item:not(&-first-item):not(&-last-item) ${childCombinator}`]: {
@@ -64,18 +78,12 @@ function compactItemBorderRadius(prefixCls: string, borderedElementCls?: string)
export function genCompactItemStyle(
token: DerivativeToken,
prefixCls: string,
- /** Some component borders are implemented on child elements like `Select` */
- borderedElementCls?: string,
- /**
- * Some components have special `focus` className especially with popovers like `Select` and
- * `DatePicker`
- */
- popoverFocusedCls?: string,
+ options: CompactItemOptions = { focus: true },
): CSSObject {
return {
'&-compact': {
- ...compactItemBorder(token, borderedElementCls, popoverFocusedCls),
- ...compactItemBorderRadius(prefixCls, borderedElementCls),
+ ...compactItemBorder(token, options),
+ ...compactItemBorderRadius(prefixCls, options),
},
};
}
diff --git a/components/style/index.tsx b/components/style/index.tsx
index 743ac86d504e..bcac9ee92a15 100644
--- a/components/style/index.tsx
+++ b/components/style/index.tsx
@@ -103,15 +103,11 @@ export const genLinkStyle = (token: DerivativeToken): CSSObject => ({
},
});
-export const genCommonStyle = (token: DerivativeToken, componentPrefixCls: string): CSSObject => {
- const { fontFamily, fontSize } = token;
-
+export const genCommonStyle = (componentPrefixCls: string): CSSObject => {
const rootPrefixSelector = `[class^="${componentPrefixCls}"], [class*=" ${componentPrefixCls}"]`;
return {
[rootPrefixSelector]: {
- fontFamily,
- fontSize,
boxSizing: 'border-box',
'&::before, &::after': {
diff --git a/components/switch/style/index.tsx b/components/switch/style/index.tsx
index 2a5018ebb24a..d712357854cb 100644
--- a/components/switch/style/index.tsx
+++ b/components/switch/style/index.tsx
@@ -182,6 +182,7 @@ const genSwitchInnerStyle: GenerateStyle