mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-11-30 11:08:45 +08:00
chore: add Button.shape 'default' definition (#32004)
* feat: add Button.shape 'default' * fix: ignore shape when falsy value * fix: generate className only when shape match * fix: remove necessary .ant-btn-default and update snapshot
This commit is contained in:
parent
b5fffcab87
commit
008242b35e
@ -1184,7 +1184,7 @@ Array [
|
||||
class="ant-btn-group ant-dropdown-button"
|
||||
>
|
||||
<button
|
||||
class="ant-btn ant-btn-default"
|
||||
class="ant-btn"
|
||||
type="button"
|
||||
>
|
||||
<span>
|
||||
@ -1192,7 +1192,7 @@ Array [
|
||||
</span>
|
||||
</button>
|
||||
<button
|
||||
class="ant-btn ant-btn-default ant-btn-icon-only ant-dropdown-trigger"
|
||||
class="ant-btn ant-btn-icon-only ant-dropdown-trigger"
|
||||
type="button"
|
||||
>
|
||||
<span
|
||||
|
@ -78,7 +78,7 @@ function spaceChildren(children: React.ReactNode, needInserted: boolean) {
|
||||
|
||||
const ButtonTypes = tuple('default', 'primary', 'ghost', 'dashed', 'link', 'text');
|
||||
export type ButtonType = typeof ButtonTypes[number];
|
||||
const ButtonShapes = tuple('circle', 'round');
|
||||
const ButtonShapes = tuple('default', 'circle', 'round');
|
||||
export type ButtonShape = typeof ButtonShapes[number];
|
||||
const ButtonHTMLTypes = tuple('submit', 'button', 'reset');
|
||||
export type ButtonHTMLType = typeof ButtonHTMLTypes[number];
|
||||
@ -94,6 +94,7 @@ export function convertLegacyProps(type?: LegacyButtonType): ButtonProps {
|
||||
export interface BaseButtonProps {
|
||||
type?: ButtonType;
|
||||
icon?: React.ReactNode;
|
||||
/** @default default */
|
||||
shape?: ButtonShape;
|
||||
size?: SizeType;
|
||||
loading?: boolean | { delay?: number };
|
||||
@ -137,7 +138,7 @@ const InternalButton: React.ForwardRefRenderFunction<unknown, ButtonProps> = (pr
|
||||
prefixCls: customizePrefixCls,
|
||||
type,
|
||||
danger,
|
||||
shape,
|
||||
shape = 'default',
|
||||
size: customizeSize,
|
||||
className,
|
||||
children,
|
||||
@ -241,7 +242,7 @@ const InternalButton: React.ForwardRefRenderFunction<unknown, ButtonProps> = (pr
|
||||
prefixCls,
|
||||
{
|
||||
[`${prefixCls}-${type}`]: type,
|
||||
[`${prefixCls}-${shape}`]: shape,
|
||||
[`${prefixCls}-${shape}`]: shape !== 'default' && shape,
|
||||
[`${prefixCls}-${sizeCls}`]: sizeCls,
|
||||
[`${prefixCls}-icon-only`]: !children && children !== 0 && !!iconType,
|
||||
[`${prefixCls}-background-ghost`]: ghost && !isUnborderedButtonType(type),
|
||||
|
@ -40,7 +40,7 @@ Different button styles can be generated by setting Button properties. The recom
|
||||
| htmlType | Set the original html `type` of `button`, see: [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#attr-type) | string | `button` | |
|
||||
| icon | Set the icon component of button | ReactNode | - | |
|
||||
| loading | Set the loading status of button | boolean \| { delay: number } | false | |
|
||||
| shape | Can be set button shape | `circle` \| `round` | - | |
|
||||
| shape | Can be set button shape | `default` \| `circle` \| `round` | 'default' | |
|
||||
| size | Set the size of button | `large` \| `middle` \| `small` | `middle` | |
|
||||
| target | Same as target attribute of a, works when href is specified | string | - | |
|
||||
| type | Can be set to `primary` `ghost` `dashed` `link` `text` `default` | string | `default` | |
|
||||
|
@ -43,7 +43,7 @@ cover: https://gw.alipayobjects.com/zos/alicdn/fNUKzY1sk/Button.svg
|
||||
| htmlType | 设置 `button` 原生的 `type` 值,可选值请参考 [HTML 标准](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#attr-type) | string | `button` | |
|
||||
| icon | 设置按钮的图标组件 | ReactNode | - | |
|
||||
| loading | 设置按钮载入状态 | boolean \| { delay: number } | false | |
|
||||
| shape | 设置按钮形状 | `circle` \| `round` | - | |
|
||||
| shape | 设置按钮形状 | `default` \| `circle` \| `round` | 'default' | |
|
||||
| size | 设置按钮大小 | `large` \| `middle` \| `small` | `middle` | |
|
||||
| target | 相当于 a 链接的 target 属性,href 存在时生效 | string | - | |
|
||||
| type | 设置按钮类型 | `primary` \| `ghost` \| `dashed` \| `link` \| `text` \| `default` | `default` | |
|
||||
|
@ -12665,7 +12665,7 @@ exports[`ConfigProvider components Dropdown configProvider 1`] = `
|
||||
class="config-btn-group config-dropdown-button"
|
||||
>
|
||||
<button
|
||||
class="config-btn config-btn-default"
|
||||
class="config-btn"
|
||||
type="button"
|
||||
>
|
||||
<span>
|
||||
@ -12673,7 +12673,7 @@ exports[`ConfigProvider components Dropdown configProvider 1`] = `
|
||||
</span>
|
||||
</button>
|
||||
<button
|
||||
class="config-btn config-btn-default config-btn-icon-only config-dropdown-trigger"
|
||||
class="config-btn config-btn-icon-only config-dropdown-trigger"
|
||||
type="button"
|
||||
>
|
||||
<span
|
||||
@ -12704,7 +12704,7 @@ exports[`ConfigProvider components Dropdown configProvider componentSize large 1
|
||||
class="config-btn-group config-dropdown-button"
|
||||
>
|
||||
<button
|
||||
class="config-btn config-btn-default config-btn-lg"
|
||||
class="config-btn config-btn-lg"
|
||||
type="button"
|
||||
>
|
||||
<span>
|
||||
@ -12712,7 +12712,7 @@ exports[`ConfigProvider components Dropdown configProvider componentSize large 1
|
||||
</span>
|
||||
</button>
|
||||
<button
|
||||
class="config-btn config-btn-default config-btn-lg config-btn-icon-only config-dropdown-trigger"
|
||||
class="config-btn config-btn-lg config-btn-icon-only config-dropdown-trigger"
|
||||
type="button"
|
||||
>
|
||||
<span
|
||||
@ -12743,7 +12743,7 @@ exports[`ConfigProvider components Dropdown configProvider componentSize middle
|
||||
class="config-btn-group config-dropdown-button"
|
||||
>
|
||||
<button
|
||||
class="config-btn config-btn-default"
|
||||
class="config-btn"
|
||||
type="button"
|
||||
>
|
||||
<span>
|
||||
@ -12751,7 +12751,7 @@ exports[`ConfigProvider components Dropdown configProvider componentSize middle
|
||||
</span>
|
||||
</button>
|
||||
<button
|
||||
class="config-btn config-btn-default config-btn-icon-only config-dropdown-trigger"
|
||||
class="config-btn config-btn-icon-only config-dropdown-trigger"
|
||||
type="button"
|
||||
>
|
||||
<span
|
||||
@ -12782,7 +12782,7 @@ exports[`ConfigProvider components Dropdown configProvider virtual and dropdownM
|
||||
class="ant-btn-group ant-dropdown-button"
|
||||
>
|
||||
<button
|
||||
class="ant-btn ant-btn-default"
|
||||
class="ant-btn"
|
||||
type="button"
|
||||
>
|
||||
<span>
|
||||
@ -12790,7 +12790,7 @@ exports[`ConfigProvider components Dropdown configProvider virtual and dropdownM
|
||||
</span>
|
||||
</button>
|
||||
<button
|
||||
class="ant-btn ant-btn-default ant-btn-icon-only ant-dropdown-trigger"
|
||||
class="ant-btn ant-btn-icon-only ant-dropdown-trigger"
|
||||
type="button"
|
||||
>
|
||||
<span
|
||||
@ -12821,7 +12821,7 @@ exports[`ConfigProvider components Dropdown normal 1`] = `
|
||||
class="ant-btn-group ant-dropdown-button"
|
||||
>
|
||||
<button
|
||||
class="ant-btn ant-btn-default"
|
||||
class="ant-btn"
|
||||
type="button"
|
||||
>
|
||||
<span>
|
||||
@ -12829,7 +12829,7 @@ exports[`ConfigProvider components Dropdown normal 1`] = `
|
||||
</span>
|
||||
</button>
|
||||
<button
|
||||
class="ant-btn ant-btn-default ant-btn-icon-only ant-dropdown-trigger"
|
||||
class="ant-btn ant-btn-icon-only ant-dropdown-trigger"
|
||||
type="button"
|
||||
>
|
||||
<span
|
||||
@ -12860,7 +12860,7 @@ exports[`ConfigProvider components Dropdown prefixCls 1`] = `
|
||||
class="ant-btn-group prefix-Dropdown"
|
||||
>
|
||||
<button
|
||||
class="ant-btn ant-btn-default"
|
||||
class="ant-btn"
|
||||
type="button"
|
||||
>
|
||||
<span>
|
||||
@ -12868,7 +12868,7 @@ exports[`ConfigProvider components Dropdown prefixCls 1`] = `
|
||||
</span>
|
||||
</button>
|
||||
<button
|
||||
class="ant-btn ant-btn-default ant-btn-icon-only ant-dropdown-trigger"
|
||||
class="ant-btn ant-btn-icon-only ant-dropdown-trigger"
|
||||
type="button"
|
||||
>
|
||||
<span
|
||||
|
@ -103,7 +103,7 @@ exports[`renders ./components/dropdown/demo/dropdown-button.md correctly 1`] = `
|
||||
class="ant-btn-group ant-dropdown-button"
|
||||
>
|
||||
<button
|
||||
class="ant-btn ant-btn-default"
|
||||
class="ant-btn"
|
||||
type="button"
|
||||
>
|
||||
<span>
|
||||
@ -111,7 +111,7 @@ exports[`renders ./components/dropdown/demo/dropdown-button.md correctly 1`] = `
|
||||
</span>
|
||||
</button>
|
||||
<button
|
||||
class="ant-btn ant-btn-default ant-btn-icon-only ant-dropdown-trigger"
|
||||
class="ant-btn ant-btn-icon-only ant-dropdown-trigger"
|
||||
type="button"
|
||||
>
|
||||
<span
|
||||
@ -144,7 +144,7 @@ exports[`renders ./components/dropdown/demo/dropdown-button.md correctly 1`] = `
|
||||
class="ant-btn-group ant-dropdown-button"
|
||||
>
|
||||
<button
|
||||
class="ant-btn ant-btn-default"
|
||||
class="ant-btn"
|
||||
type="button"
|
||||
>
|
||||
<span>
|
||||
@ -152,7 +152,7 @@ exports[`renders ./components/dropdown/demo/dropdown-button.md correctly 1`] = `
|
||||
</span>
|
||||
</button>
|
||||
<button
|
||||
class="ant-btn ant-btn-default ant-btn-icon-only ant-dropdown-trigger"
|
||||
class="ant-btn ant-btn-icon-only ant-dropdown-trigger"
|
||||
type="button"
|
||||
>
|
||||
<span
|
||||
@ -185,7 +185,7 @@ exports[`renders ./components/dropdown/demo/dropdown-button.md correctly 1`] = `
|
||||
class="ant-btn-group ant-dropdown-button"
|
||||
>
|
||||
<button
|
||||
class="ant-btn ant-btn-default"
|
||||
class="ant-btn"
|
||||
disabled=""
|
||||
type="button"
|
||||
>
|
||||
@ -194,7 +194,7 @@ exports[`renders ./components/dropdown/demo/dropdown-button.md correctly 1`] = `
|
||||
</span>
|
||||
</button>
|
||||
<button
|
||||
class="ant-btn ant-btn-default ant-btn-icon-only ant-dropdown-trigger"
|
||||
class="ant-btn ant-btn-icon-only ant-dropdown-trigger"
|
||||
disabled=""
|
||||
type="button"
|
||||
>
|
||||
@ -228,7 +228,7 @@ exports[`renders ./components/dropdown/demo/dropdown-button.md correctly 1`] = `
|
||||
class="ant-btn-group ant-dropdown-button"
|
||||
>
|
||||
<button
|
||||
class="ant-btn ant-btn-default"
|
||||
class="ant-btn"
|
||||
type="button"
|
||||
>
|
||||
<span>
|
||||
@ -236,7 +236,7 @@ exports[`renders ./components/dropdown/demo/dropdown-button.md correctly 1`] = `
|
||||
</span>
|
||||
</button>
|
||||
<button
|
||||
class="ant-btn ant-btn-default ant-btn-icon-only ant-btn-loading ant-dropdown-trigger"
|
||||
class="ant-btn ant-btn-icon-only ant-btn-loading ant-dropdown-trigger"
|
||||
type="button"
|
||||
>
|
||||
<span
|
||||
|
@ -5,11 +5,11 @@ exports[`DropdownButton rtl render component should be rendered correctly in RTL
|
||||
class="ant-btn-group ant-btn-group-rtl ant-dropdown-button"
|
||||
>
|
||||
<button
|
||||
class="ant-btn ant-btn-default ant-btn-rtl"
|
||||
class="ant-btn ant-btn-rtl"
|
||||
type="button"
|
||||
/>
|
||||
<button
|
||||
class="ant-btn ant-btn-default ant-btn-icon-only ant-btn-rtl ant-dropdown-trigger ant-dropdown-rtl"
|
||||
class="ant-btn ant-btn-icon-only ant-btn-rtl ant-dropdown-trigger ant-dropdown-rtl"
|
||||
type="button"
|
||||
>
|
||||
<span
|
||||
@ -40,11 +40,11 @@ exports[`DropdownButton should support href like Button 1`] = `
|
||||
class="ant-btn-group ant-dropdown-button"
|
||||
>
|
||||
<a
|
||||
class="ant-btn ant-btn-default"
|
||||
class="ant-btn"
|
||||
href="https://ant.design"
|
||||
/>
|
||||
<button
|
||||
class="ant-btn ant-btn-default ant-btn-icon-only ant-dropdown-trigger"
|
||||
class="ant-btn ant-btn-icon-only ant-dropdown-trigger"
|
||||
type="button"
|
||||
>
|
||||
<span
|
||||
|
Loading…
Reference in New Issue
Block a user