ant-design/components/button/button.tsx

370 lines
11 KiB
TypeScript
Raw Normal View History

import React, { Children, useContext, useEffect, useMemo, useRef, useState } from 'react';
import classNames from 'classnames';
import omit from 'rc-util/lib/omit';
import { useComposeRef } from 'rc-util/lib/ref';
import { devUseWarning } from '../_util/warning';
import Wave from '../_util/wave';
import { ConfigContext } from '../config-provider';
import DisabledContext from '../config-provider/DisabledContext';
import useSize from '../config-provider/hooks/useSize';
import type { SizeType } from '../config-provider/SizeContext';
feat: add Space.Compact (#37652) * feat: add Space.Compact * feat: update input style * feat: add CompactItem for context memoize * feat: add demo * feat: update button style * feat: update input style * feat: 提取 getCompactClassNames 公用方法 * feat: update button style * feat: update picker * feat: add block prop for Space.Compact * feat: use Space.Compact for Input#addonBefore/After * feat: update addon * refactor: compact * feat: update * feat: update * feat: migrate styles to compact for new Input/Input.Search * feat: organize input demo * feat: add more button compact demo * feat: resolve select border collapse * feat: fix input addon select style * feat: add input addon demo in Space * feat: add useCompactItemContext hook * feat: update compact-item style * feat: rollback input#addon implements * feat: rollback input#addon and input.search style * feat: select border collapse * feat: add Space.Compact demo * feat: Space.Compact vertical for Button * refactor: useCompactItemContext * feat: update Button vertical demo * feat: rtl for compact mixin * feat: rtl for compact button * feat: input rtl * feat: add docs for Space.Compact * test: add some tests for Space.Compact * test: add tests * feat: select style * feat: handle select focus style * feat: add useCompactItemContext for Picker and Cascader * style: add compact-item style for cascader * feat: support nested Space.Compact * style: Input.Search in Space.Compact * chore: clean * feat: add useCompactItemContext for TreeSelect * fix: lint issues * fix: style lint * docs: update demos for Space.Compact * docs: update demo * fix: add deps-lint-skip for space * fix: add deps-lint-skip for space * fix: handle edge case for useCompactItemContext * test: add search test case * chore: + bundlesize * style: merge button compact style into one file * style: improve style for nested compact * fix: stylelint * docs: update Space.Compact docs * test: update demo snapshot * test: update input debug test snapshot * docs: update doccs for Space.Compact * test: improve test cases for Compact * docs: clean demos for Compact * refactor: improve Space.Compact * fix: add useCompactItemContext for Input.Search * style: improve compact border-radius implementation * refactor: use context to make nested compact works * fix: input-number focused style * refactor: remove useless style * refactor: improve style for vertical compact * test: update snapshot * test: update snapshot for input * refactor: improve compact-item-border-radius * fix: search group in RTL * style: improve style for button compact * style: use after * fix: stylelint * chore: update snapshot * style: improve button compact * refactor: improve btn-icon-only style in compact
2022-10-18 16:23:10 +08:00
import { useCompactItemContext } from '../space/Compact';
import Group, { GroupSizeContext } from './button-group';
feat(Button): support variant and color (#50051) * feat(button): variant & color types * feat: type -> color/variant * feat: type -> color/variant * feat: add variant filled * test: snap * refactor(button): rename type -> variant * docs: add demo * feat: add danger ghost style * refactor: remove deprecated * refactor: eslint * docs: change color&variant * test: updated snap * docs: color-variant * docs: add debug color&variant * feat: global token * refactor: remove comment * docs: add color&variant docs * docs: remove default * docs: add space * docs: code * test: update snap * test: fix snap * test: btn querySelect * feat: change filled hoverStyle * test: fix * feat: support grey wave * refactor: enhance * docs: color/variant -> v 5.21 * test: snap * feat: add token * test: to do * test: fix test * ci: rebuild * style: remove * style: space * docs: add note & FQA * feat: add componentsToken * refactor: remove isNotGrey * test: add case * docs: tile button * test: snap * docs: site & snap * Update components/button/index.en-US.md Co-authored-by: lijianan <574980606@qq.com> Signed-off-by: ice <49827327+coding-ice@users.noreply.github.com> * fix: token color & undef * docs: site * docs: responsive * docs: enhance FAQ * docs: gap middle * test: snap * Update components/theme/interface/maps/colors.ts Co-authored-by: MadCcc <1075746765@qq.com> Signed-off-by: ice <49827327+coding-ice@users.noreply.github.com> * Update components/theme/interface/maps/colors.ts Co-authored-by: MadCcc <1075746765@qq.com> Signed-off-by: ice <49827327+coding-ice@users.noreply.github.com> * Update components/theme/interface/maps/colors.ts Co-authored-by: MadCcc <1075746765@qq.com> Signed-off-by: ice <49827327+coding-ice@users.noreply.github.com> * Update components/button/style/token.ts Co-authored-by: MadCcc <1075746765@qq.com> Signed-off-by: ice <49827327+coding-ice@users.noreply.github.com> * Update components/button/style/token.ts Co-authored-by: MadCcc <1075746765@qq.com> Signed-off-by: ice <49827327+coding-ice@users.noreply.github.com> * refactor: rename * docs: prettier * chore: eslint * refactor: cls * test: add solidTextColor case * refactor: genVariantButtonStyle * refactor: genVariantButtonStyle * refactor: genVariantButtonStyle * fix: rename * docs: text * fix: remove border * feat: add token colorErrorBgFilledHover * chore: add size-limit * refactor: rename --------- Signed-off-by: ice <49827327+coding-ice@users.noreply.github.com> Co-authored-by: lijianan <574980606@qq.com> Co-authored-by: MadCcc <1075746765@qq.com>
2024-09-03 17:39:02 +08:00
import type {
ButtonColorType,
ButtonHTMLType,
ButtonShape,
ButtonType,
ButtonVariantType,
} from './buttonHelpers';
import { isTwoCNChar, isUnBorderedButtonVariant, spaceChildren } from './buttonHelpers';
import IconWrapper from './IconWrapper';
import LoadingIcon from './LoadingIcon';
import useStyle from './style';
import Compact from './style/compact';
export type LegacyButtonType = ButtonType | 'danger';
2018-05-18 18:22:33 +08:00
export interface BaseButtonProps {
2016-07-14 13:29:50 +08:00
type?: ButtonType;
feat(Button): support variant and color (#50051) * feat(button): variant & color types * feat: type -> color/variant * feat: type -> color/variant * feat: add variant filled * test: snap * refactor(button): rename type -> variant * docs: add demo * feat: add danger ghost style * refactor: remove deprecated * refactor: eslint * docs: change color&variant * test: updated snap * docs: color-variant * docs: add debug color&variant * feat: global token * refactor: remove comment * docs: add color&variant docs * docs: remove default * docs: add space * docs: code * test: update snap * test: fix snap * test: btn querySelect * feat: change filled hoverStyle * test: fix * feat: support grey wave * refactor: enhance * docs: color/variant -> v 5.21 * test: snap * feat: add token * test: to do * test: fix test * ci: rebuild * style: remove * style: space * docs: add note & FQA * feat: add componentsToken * refactor: remove isNotGrey * test: add case * docs: tile button * test: snap * docs: site & snap * Update components/button/index.en-US.md Co-authored-by: lijianan <574980606@qq.com> Signed-off-by: ice <49827327+coding-ice@users.noreply.github.com> * fix: token color & undef * docs: site * docs: responsive * docs: enhance FAQ * docs: gap middle * test: snap * Update components/theme/interface/maps/colors.ts Co-authored-by: MadCcc <1075746765@qq.com> Signed-off-by: ice <49827327+coding-ice@users.noreply.github.com> * Update components/theme/interface/maps/colors.ts Co-authored-by: MadCcc <1075746765@qq.com> Signed-off-by: ice <49827327+coding-ice@users.noreply.github.com> * Update components/theme/interface/maps/colors.ts Co-authored-by: MadCcc <1075746765@qq.com> Signed-off-by: ice <49827327+coding-ice@users.noreply.github.com> * Update components/button/style/token.ts Co-authored-by: MadCcc <1075746765@qq.com> Signed-off-by: ice <49827327+coding-ice@users.noreply.github.com> * Update components/button/style/token.ts Co-authored-by: MadCcc <1075746765@qq.com> Signed-off-by: ice <49827327+coding-ice@users.noreply.github.com> * refactor: rename * docs: prettier * chore: eslint * refactor: cls * test: add solidTextColor case * refactor: genVariantButtonStyle * refactor: genVariantButtonStyle * refactor: genVariantButtonStyle * fix: rename * docs: text * fix: remove border * feat: add token colorErrorBgFilledHover * chore: add size-limit * refactor: rename --------- Signed-off-by: ice <49827327+coding-ice@users.noreply.github.com> Co-authored-by: lijianan <574980606@qq.com> Co-authored-by: MadCcc <1075746765@qq.com>
2024-09-03 17:39:02 +08:00
color?: ButtonColorType;
variant?: ButtonVariantType;
use ant design icons 4.0 (#18217) * feat: use @ant-design/icons@4.0 * feat: use createFromIconfontCN to make site works * feat: update doc for Icon * feat: use icon in component Alert * feat: use icon in component Avatar * feat: use icon in component Breadcrumb * feat: use icon in component Button * feat: use icon in component Cascader * feat: use icon in component Collapse * feat: use icon in component Datepicker * feat: use icon in component Dropdown * feat: use icon in component Form * feat: use icon in component Input * feat: use icon in component InputNumber * feat: use icon in component Layout * feat: use icon in component Mention * feat: use icon in component Message * feat: use icon in component Modal * feat: use icon in component Notification * feat: use icon in component PageHeader * feat: use icon in component Pagination * feat: use icon in component Popconfirm * feat: use icon in component Progress * feat: use icon in component Rate * feat: use icon in component Result * feat: use icon in component Select * feat: use icon in component Step * feat: use icon in component Switch * feat: use icon in component Table * feat: use icon in component Tab * feat: use icon in component Tag * feat: handle rest component which using Icon * fix: remove unused vars * feat: use latest alpha ant design icons * fix: failed test in uploadlist.test.js * test: update snapshot for icons * doc: add Icon for site * doc: use @ant-design/icons in site * chore: use latest icons * fix: tslint issue * fix: test cases * fix: types for react * fix: lint rules for import orders * fix: use @ant-design/icons@4.0.0-alpha.5 to avoid insert css in server render * fix: eslint error in demo/**.md * inject antd icons * update snapshot * fix site * doc: update docs * fix: code snippets icon in site * feat: use latest @ant-design/icons * fix: icon props in message
2019-08-13 14:07:17 +08:00
icon?: React.ReactNode;
feat: Support iconPosition with button icon (#47791) * feat: button support iconPosition * fix: iconPosition compatible LoadingIcon * docs(Button): update Button with iconPosition demo * fix: delete debug type * fix: iconPosition for InnerLoadingIcon with not existIcon * chore: update button snapshots * fix: fixed loading-icon-end style * chore: refactor buttonContent with genButtonContent * fix: iconPosition compatible with rtl * docs(Button): update button with iconPosition demo * chore: update test * fix: iconPosition compatible with rtl * docs(Buttob): add icon-position demo * restore icon demo * update snapshots * docs: update icon button demo * docs: update iconPosition button demo * Update components/button/index.zh-CN.md Co-authored-by: kiner-tang <1127031143@qq.com> Signed-off-by: George H <default_hyn@163.com> * Update components/button/index.zh-CN.md Co-authored-by: kiner-tang <1127031143@qq.com> Signed-off-by: George H <default_hyn@163.com> * Update components/button/demo/icon-position.md Co-authored-by: afc163 <afc163@gmail.com> Signed-off-by: George H <default_hyn@163.com> * Update components/button/index.en-US.md Co-authored-by: afc163 <afc163@gmail.com> Signed-off-by: George H <default_hyn@163.com> * Update components/button/index.en-US.md Co-authored-by: afc163 <afc163@gmail.com> Signed-off-by: George H <default_hyn@163.com> --------- Signed-off-by: George H <default_hyn@163.com> Co-authored-by: kiner-tang <1127031143@qq.com> Co-authored-by: afc163 <afc163@gmail.com>
2024-04-07 22:42:20 +08:00
iconPosition?: 'start' | 'end';
2016-07-14 13:29:50 +08:00
shape?: ButtonShape;
size?: SizeType;
disabled?: boolean;
loading?: boolean | { delay?: number };
2016-07-14 13:29:50 +08:00
prefixCls?: string;
className?: string;
rootClassName?: string;
ghost?: boolean;
2019-11-22 15:32:11 +08:00
danger?: boolean;
block?: boolean;
children?: React.ReactNode;
[key: `data-${string}`]: string;
classNames?: { icon: string };
styles?: { icon: React.CSSProperties };
2016-07-14 13:29:50 +08:00
}
type MergedHTMLAttributes = Omit<
2023-07-21 23:36:11 +08:00
React.HTMLAttributes<HTMLElement> &
React.ButtonHTMLAttributes<HTMLElement> &
React.AnchorHTMLAttributes<HTMLElement>,
feat(Button): support variant and color (#50051) * feat(button): variant & color types * feat: type -> color/variant * feat: type -> color/variant * feat: add variant filled * test: snap * refactor(button): rename type -> variant * docs: add demo * feat: add danger ghost style * refactor: remove deprecated * refactor: eslint * docs: change color&variant * test: updated snap * docs: color-variant * docs: add debug color&variant * feat: global token * refactor: remove comment * docs: add color&variant docs * docs: remove default * docs: add space * docs: code * test: update snap * test: fix snap * test: btn querySelect * feat: change filled hoverStyle * test: fix * feat: support grey wave * refactor: enhance * docs: color/variant -> v 5.21 * test: snap * feat: add token * test: to do * test: fix test * ci: rebuild * style: remove * style: space * docs: add note & FQA * feat: add componentsToken * refactor: remove isNotGrey * test: add case * docs: tile button * test: snap * docs: site & snap * Update components/button/index.en-US.md Co-authored-by: lijianan <574980606@qq.com> Signed-off-by: ice <49827327+coding-ice@users.noreply.github.com> * fix: token color & undef * docs: site * docs: responsive * docs: enhance FAQ * docs: gap middle * test: snap * Update components/theme/interface/maps/colors.ts Co-authored-by: MadCcc <1075746765@qq.com> Signed-off-by: ice <49827327+coding-ice@users.noreply.github.com> * Update components/theme/interface/maps/colors.ts Co-authored-by: MadCcc <1075746765@qq.com> Signed-off-by: ice <49827327+coding-ice@users.noreply.github.com> * Update components/theme/interface/maps/colors.ts Co-authored-by: MadCcc <1075746765@qq.com> Signed-off-by: ice <49827327+coding-ice@users.noreply.github.com> * Update components/button/style/token.ts Co-authored-by: MadCcc <1075746765@qq.com> Signed-off-by: ice <49827327+coding-ice@users.noreply.github.com> * Update components/button/style/token.ts Co-authored-by: MadCcc <1075746765@qq.com> Signed-off-by: ice <49827327+coding-ice@users.noreply.github.com> * refactor: rename * docs: prettier * chore: eslint * refactor: cls * test: add solidTextColor case * refactor: genVariantButtonStyle * refactor: genVariantButtonStyle * refactor: genVariantButtonStyle * fix: rename * docs: text * fix: remove border * feat: add token colorErrorBgFilledHover * chore: add size-limit * refactor: rename --------- Signed-off-by: ice <49827327+coding-ice@users.noreply.github.com> Co-authored-by: lijianan <574980606@qq.com> Co-authored-by: MadCcc <1075746765@qq.com>
2024-09-03 17:39:02 +08:00
'type' | 'color'
>;
2023-07-18 23:59:53 +08:00
export interface ButtonProps extends BaseButtonProps, MergedHTMLAttributes {
href?: string;
htmlType?: ButtonHTMLType;
autoInsertSpace?: boolean;
}
type LoadingConfigType = {
loading: boolean;
delay: number;
};
function getLoadingConfig(loading: BaseButtonProps['loading']): LoadingConfigType {
if (typeof loading === 'object' && loading) {
let delay = loading?.delay;
delay = !Number.isNaN(delay) && typeof delay === 'number' ? delay : 0;
return {
loading: delay <= 0,
delay,
};
}
return {
loading: !!loading,
delay: 0,
};
}
feat(Button): support variant and color (#50051) * feat(button): variant & color types * feat: type -> color/variant * feat: type -> color/variant * feat: add variant filled * test: snap * refactor(button): rename type -> variant * docs: add demo * feat: add danger ghost style * refactor: remove deprecated * refactor: eslint * docs: change color&variant * test: updated snap * docs: color-variant * docs: add debug color&variant * feat: global token * refactor: remove comment * docs: add color&variant docs * docs: remove default * docs: add space * docs: code * test: update snap * test: fix snap * test: btn querySelect * feat: change filled hoverStyle * test: fix * feat: support grey wave * refactor: enhance * docs: color/variant -> v 5.21 * test: snap * feat: add token * test: to do * test: fix test * ci: rebuild * style: remove * style: space * docs: add note & FQA * feat: add componentsToken * refactor: remove isNotGrey * test: add case * docs: tile button * test: snap * docs: site & snap * Update components/button/index.en-US.md Co-authored-by: lijianan <574980606@qq.com> Signed-off-by: ice <49827327+coding-ice@users.noreply.github.com> * fix: token color & undef * docs: site * docs: responsive * docs: enhance FAQ * docs: gap middle * test: snap * Update components/theme/interface/maps/colors.ts Co-authored-by: MadCcc <1075746765@qq.com> Signed-off-by: ice <49827327+coding-ice@users.noreply.github.com> * Update components/theme/interface/maps/colors.ts Co-authored-by: MadCcc <1075746765@qq.com> Signed-off-by: ice <49827327+coding-ice@users.noreply.github.com> * Update components/theme/interface/maps/colors.ts Co-authored-by: MadCcc <1075746765@qq.com> Signed-off-by: ice <49827327+coding-ice@users.noreply.github.com> * Update components/button/style/token.ts Co-authored-by: MadCcc <1075746765@qq.com> Signed-off-by: ice <49827327+coding-ice@users.noreply.github.com> * Update components/button/style/token.ts Co-authored-by: MadCcc <1075746765@qq.com> Signed-off-by: ice <49827327+coding-ice@users.noreply.github.com> * refactor: rename * docs: prettier * chore: eslint * refactor: cls * test: add solidTextColor case * refactor: genVariantButtonStyle * refactor: genVariantButtonStyle * refactor: genVariantButtonStyle * fix: rename * docs: text * fix: remove border * feat: add token colorErrorBgFilledHover * chore: add size-limit * refactor: rename --------- Signed-off-by: ice <49827327+coding-ice@users.noreply.github.com> Co-authored-by: lijianan <574980606@qq.com> Co-authored-by: MadCcc <1075746765@qq.com>
2024-09-03 17:39:02 +08:00
type ColorVariantPairType = [color?: ButtonColorType, variant?: ButtonVariantType];
const ButtonTypeMap: Partial<Record<ButtonType, ColorVariantPairType>> = {
default: ['default', 'outlined'],
primary: ['primary', 'solid'],
dashed: ['default', 'dashed'],
link: ['primary', 'link'],
text: ['default', 'text'],
};
const InternalCompoundedButton = React.forwardRef<
HTMLButtonElement | HTMLAnchorElement,
ButtonProps
>((props, ref) => {
2020-06-02 12:54:22 +08:00
const {
loading = false,
2020-06-02 12:54:22 +08:00
prefixCls: customizePrefixCls,
feat(Button): support variant and color (#50051) * feat(button): variant & color types * feat: type -> color/variant * feat: type -> color/variant * feat: add variant filled * test: snap * refactor(button): rename type -> variant * docs: add demo * feat: add danger ghost style * refactor: remove deprecated * refactor: eslint * docs: change color&variant * test: updated snap * docs: color-variant * docs: add debug color&variant * feat: global token * refactor: remove comment * docs: add color&variant docs * docs: remove default * docs: add space * docs: code * test: update snap * test: fix snap * test: btn querySelect * feat: change filled hoverStyle * test: fix * feat: support grey wave * refactor: enhance * docs: color/variant -> v 5.21 * test: snap * feat: add token * test: to do * test: fix test * ci: rebuild * style: remove * style: space * docs: add note & FQA * feat: add componentsToken * refactor: remove isNotGrey * test: add case * docs: tile button * test: snap * docs: site & snap * Update components/button/index.en-US.md Co-authored-by: lijianan <574980606@qq.com> Signed-off-by: ice <49827327+coding-ice@users.noreply.github.com> * fix: token color & undef * docs: site * docs: responsive * docs: enhance FAQ * docs: gap middle * test: snap * Update components/theme/interface/maps/colors.ts Co-authored-by: MadCcc <1075746765@qq.com> Signed-off-by: ice <49827327+coding-ice@users.noreply.github.com> * Update components/theme/interface/maps/colors.ts Co-authored-by: MadCcc <1075746765@qq.com> Signed-off-by: ice <49827327+coding-ice@users.noreply.github.com> * Update components/theme/interface/maps/colors.ts Co-authored-by: MadCcc <1075746765@qq.com> Signed-off-by: ice <49827327+coding-ice@users.noreply.github.com> * Update components/button/style/token.ts Co-authored-by: MadCcc <1075746765@qq.com> Signed-off-by: ice <49827327+coding-ice@users.noreply.github.com> * Update components/button/style/token.ts Co-authored-by: MadCcc <1075746765@qq.com> Signed-off-by: ice <49827327+coding-ice@users.noreply.github.com> * refactor: rename * docs: prettier * chore: eslint * refactor: cls * test: add solidTextColor case * refactor: genVariantButtonStyle * refactor: genVariantButtonStyle * refactor: genVariantButtonStyle * fix: rename * docs: text * fix: remove border * feat: add token colorErrorBgFilledHover * chore: add size-limit * refactor: rename --------- Signed-off-by: ice <49827327+coding-ice@users.noreply.github.com> Co-authored-by: lijianan <574980606@qq.com> Co-authored-by: MadCcc <1075746765@qq.com>
2024-09-03 17:39:02 +08:00
color,
variant,
2024-02-27 19:11:46 +08:00
type,
danger = false,
shape = 'default',
2020-06-02 12:54:22 +08:00
size: customizeSize,
styles,
disabled: customDisabled,
2020-06-02 12:54:22 +08:00
className,
rootClassName,
2020-06-02 12:54:22 +08:00
children,
icon,
feat: Support iconPosition with button icon (#47791) * feat: button support iconPosition * fix: iconPosition compatible LoadingIcon * docs(Button): update Button with iconPosition demo * fix: delete debug type * fix: iconPosition for InnerLoadingIcon with not existIcon * chore: update button snapshots * fix: fixed loading-icon-end style * chore: refactor buttonContent with genButtonContent * fix: iconPosition compatible with rtl * docs(Button): update button with iconPosition demo * chore: update test * fix: iconPosition compatible with rtl * docs(Buttob): add icon-position demo * restore icon demo * update snapshots * docs: update icon button demo * docs: update iconPosition button demo * Update components/button/index.zh-CN.md Co-authored-by: kiner-tang <1127031143@qq.com> Signed-off-by: George H <default_hyn@163.com> * Update components/button/index.zh-CN.md Co-authored-by: kiner-tang <1127031143@qq.com> Signed-off-by: George H <default_hyn@163.com> * Update components/button/demo/icon-position.md Co-authored-by: afc163 <afc163@gmail.com> Signed-off-by: George H <default_hyn@163.com> * Update components/button/index.en-US.md Co-authored-by: afc163 <afc163@gmail.com> Signed-off-by: George H <default_hyn@163.com> * Update components/button/index.en-US.md Co-authored-by: afc163 <afc163@gmail.com> Signed-off-by: George H <default_hyn@163.com> --------- Signed-off-by: George H <default_hyn@163.com> Co-authored-by: kiner-tang <1127031143@qq.com> Co-authored-by: afc163 <afc163@gmail.com>
2024-04-07 22:42:20 +08:00
iconPosition = 'start',
ghost = false,
block = false,
// React does not recognize the `htmlType` prop on a DOM element. Here we pick it out of `rest`.
htmlType = 'button',
classNames: customClassNames,
style: customStyle = {},
autoInsertSpace,
autoFocus,
2020-06-02 12:54:22 +08:00
...rest
} = props;
2020-06-02 12:54:22 +08:00
2024-02-27 19:11:46 +08:00
// https://github.com/ant-design/ant-design/issues/47605
// Compatible with original `type` behavior
const mergedType = type || 'default';
feat(Button): support variant and color (#50051) * feat(button): variant & color types * feat: type -> color/variant * feat: type -> color/variant * feat: add variant filled * test: snap * refactor(button): rename type -> variant * docs: add demo * feat: add danger ghost style * refactor: remove deprecated * refactor: eslint * docs: change color&variant * test: updated snap * docs: color-variant * docs: add debug color&variant * feat: global token * refactor: remove comment * docs: add color&variant docs * docs: remove default * docs: add space * docs: code * test: update snap * test: fix snap * test: btn querySelect * feat: change filled hoverStyle * test: fix * feat: support grey wave * refactor: enhance * docs: color/variant -> v 5.21 * test: snap * feat: add token * test: to do * test: fix test * ci: rebuild * style: remove * style: space * docs: add note & FQA * feat: add componentsToken * refactor: remove isNotGrey * test: add case * docs: tile button * test: snap * docs: site & snap * Update components/button/index.en-US.md Co-authored-by: lijianan <574980606@qq.com> Signed-off-by: ice <49827327+coding-ice@users.noreply.github.com> * fix: token color & undef * docs: site * docs: responsive * docs: enhance FAQ * docs: gap middle * test: snap * Update components/theme/interface/maps/colors.ts Co-authored-by: MadCcc <1075746765@qq.com> Signed-off-by: ice <49827327+coding-ice@users.noreply.github.com> * Update components/theme/interface/maps/colors.ts Co-authored-by: MadCcc <1075746765@qq.com> Signed-off-by: ice <49827327+coding-ice@users.noreply.github.com> * Update components/theme/interface/maps/colors.ts Co-authored-by: MadCcc <1075746765@qq.com> Signed-off-by: ice <49827327+coding-ice@users.noreply.github.com> * Update components/button/style/token.ts Co-authored-by: MadCcc <1075746765@qq.com> Signed-off-by: ice <49827327+coding-ice@users.noreply.github.com> * Update components/button/style/token.ts Co-authored-by: MadCcc <1075746765@qq.com> Signed-off-by: ice <49827327+coding-ice@users.noreply.github.com> * refactor: rename * docs: prettier * chore: eslint * refactor: cls * test: add solidTextColor case * refactor: genVariantButtonStyle * refactor: genVariantButtonStyle * refactor: genVariantButtonStyle * fix: rename * docs: text * fix: remove border * feat: add token colorErrorBgFilledHover * chore: add size-limit * refactor: rename --------- Signed-off-by: ice <49827327+coding-ice@users.noreply.github.com> Co-authored-by: lijianan <574980606@qq.com> Co-authored-by: MadCcc <1075746765@qq.com>
2024-09-03 17:39:02 +08:00
const [mergedColor, mergedVariant] = useMemo<ColorVariantPairType>(() => {
if (color && variant) {
return [color, variant];
}
const colorVariantPair = ButtonTypeMap[mergedType] || [];
if (danger) {
return ['danger', colorVariantPair[1]];
}
return colorVariantPair;
}, [type, color, variant, danger]);
const isDanger = mergedColor === 'danger';
const mergedColorText = isDanger ? 'dangerous' : mergedColor;
const { getPrefixCls, direction, button } = useContext(ConfigContext);
const mergedInsertSpace = autoInsertSpace ?? button?.autoInsertSpace ?? true;
const prefixCls = getPrefixCls('btn', customizePrefixCls);
const [wrapCSSVar, hashId, cssVarCls] = useStyle(prefixCls);
const disabled = useContext(DisabledContext);
const mergedDisabled = customDisabled ?? disabled;
const groupSize = useContext(GroupSizeContext);
2023-04-26 14:52:21 +08:00
const loadingOrDelay = useMemo<LoadingConfigType>(() => getLoadingConfig(loading), [loading]);
2023-04-26 14:52:21 +08:00
const [innerLoading, setLoading] = useState<boolean>(loadingOrDelay.loading);
const [hasTwoCNChar, setHasTwoCNChar] = useState<boolean>(false);
const buttonRef = useRef<HTMLButtonElement | HTMLAnchorElement>();
2016-07-14 13:29:50 +08:00
const mergedRef = useComposeRef(ref, buttonRef);
2024-02-27 19:11:46 +08:00
const needInserted =
feat(Button): support variant and color (#50051) * feat(button): variant & color types * feat: type -> color/variant * feat: type -> color/variant * feat: add variant filled * test: snap * refactor(button): rename type -> variant * docs: add demo * feat: add danger ghost style * refactor: remove deprecated * refactor: eslint * docs: change color&variant * test: updated snap * docs: color-variant * docs: add debug color&variant * feat: global token * refactor: remove comment * docs: add color&variant docs * docs: remove default * docs: add space * docs: code * test: update snap * test: fix snap * test: btn querySelect * feat: change filled hoverStyle * test: fix * feat: support grey wave * refactor: enhance * docs: color/variant -> v 5.21 * test: snap * feat: add token * test: to do * test: fix test * ci: rebuild * style: remove * style: space * docs: add note & FQA * feat: add componentsToken * refactor: remove isNotGrey * test: add case * docs: tile button * test: snap * docs: site & snap * Update components/button/index.en-US.md Co-authored-by: lijianan <574980606@qq.com> Signed-off-by: ice <49827327+coding-ice@users.noreply.github.com> * fix: token color & undef * docs: site * docs: responsive * docs: enhance FAQ * docs: gap middle * test: snap * Update components/theme/interface/maps/colors.ts Co-authored-by: MadCcc <1075746765@qq.com> Signed-off-by: ice <49827327+coding-ice@users.noreply.github.com> * Update components/theme/interface/maps/colors.ts Co-authored-by: MadCcc <1075746765@qq.com> Signed-off-by: ice <49827327+coding-ice@users.noreply.github.com> * Update components/theme/interface/maps/colors.ts Co-authored-by: MadCcc <1075746765@qq.com> Signed-off-by: ice <49827327+coding-ice@users.noreply.github.com> * Update components/button/style/token.ts Co-authored-by: MadCcc <1075746765@qq.com> Signed-off-by: ice <49827327+coding-ice@users.noreply.github.com> * Update components/button/style/token.ts Co-authored-by: MadCcc <1075746765@qq.com> Signed-off-by: ice <49827327+coding-ice@users.noreply.github.com> * refactor: rename * docs: prettier * chore: eslint * refactor: cls * test: add solidTextColor case * refactor: genVariantButtonStyle * refactor: genVariantButtonStyle * refactor: genVariantButtonStyle * fix: rename * docs: text * fix: remove border * feat: add token colorErrorBgFilledHover * chore: add size-limit * refactor: rename --------- Signed-off-by: ice <49827327+coding-ice@users.noreply.github.com> Co-authored-by: lijianan <574980606@qq.com> Co-authored-by: MadCcc <1075746765@qq.com>
2024-09-03 17:39:02 +08:00
Children.count(children) === 1 && !icon && !isUnBorderedButtonVariant(mergedVariant);
// ========================= Effect =========================
// Loading
useEffect(() => {
let delayTimer: ReturnType<typeof setTimeout> | null = null;
if (loadingOrDelay.delay > 0) {
2023-04-26 14:52:21 +08:00
delayTimer = setTimeout(() => {
delayTimer = null;
setLoading(true);
}, loadingOrDelay.delay);
2020-06-02 12:54:22 +08:00
} else {
setLoading(loadingOrDelay.loading);
}
function cleanupTimer() {
if (delayTimer) {
2023-04-26 14:52:21 +08:00
clearTimeout(delayTimer);
delayTimer = null;
}
}
return cleanupTimer;
2020-06-03 21:59:54 +08:00
}, [loadingOrDelay]);
2016-05-28 15:31:39 +08:00
// Two chinese characters check
useEffect(() => {
// FIXME: for HOC usage like <FormatMessage />
if (!buttonRef.current || !mergedInsertSpace) {
return;
}
const buttonText = buttonRef.current.textContent || '';
if (needInserted && isTwoCNChar(buttonText)) {
if (!hasTwoCNChar) {
setHasTwoCNChar(true);
}
} else if (hasTwoCNChar) {
setHasTwoCNChar(false);
}
});
2018-10-30 16:08:55 +08:00
// Auto focus
useEffect(() => {
if (autoFocus && buttonRef.current) {
buttonRef.current.focus();
}
}, []);
// ========================= Events =========================
const handleClick = React.useCallback(
(e: React.MouseEvent<HTMLButtonElement | HTMLAnchorElement, MouseEvent>) => {
// FIXME: https://github.com/ant-design/ant-design/issues/30207
if (innerLoading || mergedDisabled) {
e.preventDefault();
return;
}
props.onClick?.(e);
},
[props.onClick, innerLoading, mergedDisabled],
);
// ========================== Warn ==========================
if (process.env.NODE_ENV !== 'production') {
const warning = devUseWarning('Button');
warning(
!(typeof icon === 'string' && icon.length > 2),
'breaking',
`\`icon\` is using ReactNode instead of string naming in v4. Please check \`${icon}\` at https://ant.design/components/icon`,
);
warning(
feat(Button): support variant and color (#50051) * feat(button): variant & color types * feat: type -> color/variant * feat: type -> color/variant * feat: add variant filled * test: snap * refactor(button): rename type -> variant * docs: add demo * feat: add danger ghost style * refactor: remove deprecated * refactor: eslint * docs: change color&variant * test: updated snap * docs: color-variant * docs: add debug color&variant * feat: global token * refactor: remove comment * docs: add color&variant docs * docs: remove default * docs: add space * docs: code * test: update snap * test: fix snap * test: btn querySelect * feat: change filled hoverStyle * test: fix * feat: support grey wave * refactor: enhance * docs: color/variant -> v 5.21 * test: snap * feat: add token * test: to do * test: fix test * ci: rebuild * style: remove * style: space * docs: add note & FQA * feat: add componentsToken * refactor: remove isNotGrey * test: add case * docs: tile button * test: snap * docs: site & snap * Update components/button/index.en-US.md Co-authored-by: lijianan <574980606@qq.com> Signed-off-by: ice <49827327+coding-ice@users.noreply.github.com> * fix: token color & undef * docs: site * docs: responsive * docs: enhance FAQ * docs: gap middle * test: snap * Update components/theme/interface/maps/colors.ts Co-authored-by: MadCcc <1075746765@qq.com> Signed-off-by: ice <49827327+coding-ice@users.noreply.github.com> * Update components/theme/interface/maps/colors.ts Co-authored-by: MadCcc <1075746765@qq.com> Signed-off-by: ice <49827327+coding-ice@users.noreply.github.com> * Update components/theme/interface/maps/colors.ts Co-authored-by: MadCcc <1075746765@qq.com> Signed-off-by: ice <49827327+coding-ice@users.noreply.github.com> * Update components/button/style/token.ts Co-authored-by: MadCcc <1075746765@qq.com> Signed-off-by: ice <49827327+coding-ice@users.noreply.github.com> * Update components/button/style/token.ts Co-authored-by: MadCcc <1075746765@qq.com> Signed-off-by: ice <49827327+coding-ice@users.noreply.github.com> * refactor: rename * docs: prettier * chore: eslint * refactor: cls * test: add solidTextColor case * refactor: genVariantButtonStyle * refactor: genVariantButtonStyle * refactor: genVariantButtonStyle * fix: rename * docs: text * fix: remove border * feat: add token colorErrorBgFilledHover * chore: add size-limit * refactor: rename --------- Signed-off-by: ice <49827327+coding-ice@users.noreply.github.com> Co-authored-by: lijianan <574980606@qq.com> Co-authored-by: MadCcc <1075746765@qq.com>
2024-09-03 17:39:02 +08:00
!(ghost && isUnBorderedButtonVariant(mergedVariant)),
'usage',
"`link` or `text` button can't be a `ghost` button.",
);
}
// ========================== Size ==========================
feat: add Space.Compact (#37652) * feat: add Space.Compact * feat: update input style * feat: add CompactItem for context memoize * feat: add demo * feat: update button style * feat: update input style * feat: 提取 getCompactClassNames 公用方法 * feat: update button style * feat: update picker * feat: add block prop for Space.Compact * feat: use Space.Compact for Input#addonBefore/After * feat: update addon * refactor: compact * feat: update * feat: update * feat: migrate styles to compact for new Input/Input.Search * feat: organize input demo * feat: add more button compact demo * feat: resolve select border collapse * feat: fix input addon select style * feat: add input addon demo in Space * feat: add useCompactItemContext hook * feat: update compact-item style * feat: rollback input#addon implements * feat: rollback input#addon and input.search style * feat: select border collapse * feat: add Space.Compact demo * feat: Space.Compact vertical for Button * refactor: useCompactItemContext * feat: update Button vertical demo * feat: rtl for compact mixin * feat: rtl for compact button * feat: input rtl * feat: add docs for Space.Compact * test: add some tests for Space.Compact * test: add tests * feat: select style * feat: handle select focus style * feat: add useCompactItemContext for Picker and Cascader * style: add compact-item style for cascader * feat: support nested Space.Compact * style: Input.Search in Space.Compact * chore: clean * feat: add useCompactItemContext for TreeSelect * fix: lint issues * fix: style lint * docs: update demos for Space.Compact * docs: update demo * fix: add deps-lint-skip for space * fix: add deps-lint-skip for space * fix: handle edge case for useCompactItemContext * test: add search test case * chore: + bundlesize * style: merge button compact style into one file * style: improve style for nested compact * fix: stylelint * docs: update Space.Compact docs * test: update demo snapshot * test: update input debug test snapshot * docs: update doccs for Space.Compact * test: improve test cases for Compact * docs: clean demos for Compact * refactor: improve Space.Compact * fix: add useCompactItemContext for Input.Search * style: improve compact border-radius implementation * refactor: use context to make nested compact works * fix: input-number focused style * refactor: remove useless style * refactor: improve style for vertical compact * test: update snapshot * test: update snapshot for input * refactor: improve compact-item-border-radius * fix: search group in RTL * style: improve style for button compact * style: use after * fix: stylelint * chore: update snapshot * style: improve button compact * refactor: improve btn-icon-only style in compact
2022-10-18 16:23:10 +08:00
const { compactSize, compactItemClassnames } = useCompactItemContext(prefixCls, direction);
const sizeClassNameMap = { large: 'lg', small: 'sm', middle: undefined };
const sizeFullName = useSize((ctxSize) => customizeSize ?? compactSize ?? groupSize ?? ctxSize);
const sizeCls = sizeFullName ? (sizeClassNameMap[sizeFullName] ?? '') : '';
2020-06-02 12:54:22 +08:00
const iconType = innerLoading ? 'loading' : icon;
const linkButtonRestProps = omit(rest as ButtonProps & { navigate: any }, ['navigate']);
// ========================= Render =========================
const classes = classNames(
prefixCls,
hashId,
cssVarCls,
{
[`${prefixCls}-${shape}`]: shape !== 'default' && shape,
// line(253 - 254): Compatible with versions earlier than 5.21.0
[`${prefixCls}-${mergedType}`]: mergedType,
[`${prefixCls}-dangerous`]: danger,
[`${prefixCls}-color-${mergedColorText}`]: mergedColorText,
[`${prefixCls}-variant-${mergedVariant}`]: mergedVariant,
[`${prefixCls}-${sizeCls}`]: sizeCls,
2021-04-02 22:37:36 +08:00
[`${prefixCls}-icon-only`]: !children && children !== 0 && !!iconType,
feat(Button): support variant and color (#50051) * feat(button): variant & color types * feat: type -> color/variant * feat: type -> color/variant * feat: add variant filled * test: snap * refactor(button): rename type -> variant * docs: add demo * feat: add danger ghost style * refactor: remove deprecated * refactor: eslint * docs: change color&variant * test: updated snap * docs: color-variant * docs: add debug color&variant * feat: global token * refactor: remove comment * docs: add color&variant docs * docs: remove default * docs: add space * docs: code * test: update snap * test: fix snap * test: btn querySelect * feat: change filled hoverStyle * test: fix * feat: support grey wave * refactor: enhance * docs: color/variant -> v 5.21 * test: snap * feat: add token * test: to do * test: fix test * ci: rebuild * style: remove * style: space * docs: add note & FQA * feat: add componentsToken * refactor: remove isNotGrey * test: add case * docs: tile button * test: snap * docs: site & snap * Update components/button/index.en-US.md Co-authored-by: lijianan <574980606@qq.com> Signed-off-by: ice <49827327+coding-ice@users.noreply.github.com> * fix: token color & undef * docs: site * docs: responsive * docs: enhance FAQ * docs: gap middle * test: snap * Update components/theme/interface/maps/colors.ts Co-authored-by: MadCcc <1075746765@qq.com> Signed-off-by: ice <49827327+coding-ice@users.noreply.github.com> * Update components/theme/interface/maps/colors.ts Co-authored-by: MadCcc <1075746765@qq.com> Signed-off-by: ice <49827327+coding-ice@users.noreply.github.com> * Update components/theme/interface/maps/colors.ts Co-authored-by: MadCcc <1075746765@qq.com> Signed-off-by: ice <49827327+coding-ice@users.noreply.github.com> * Update components/button/style/token.ts Co-authored-by: MadCcc <1075746765@qq.com> Signed-off-by: ice <49827327+coding-ice@users.noreply.github.com> * Update components/button/style/token.ts Co-authored-by: MadCcc <1075746765@qq.com> Signed-off-by: ice <49827327+coding-ice@users.noreply.github.com> * refactor: rename * docs: prettier * chore: eslint * refactor: cls * test: add solidTextColor case * refactor: genVariantButtonStyle * refactor: genVariantButtonStyle * refactor: genVariantButtonStyle * fix: rename * docs: text * fix: remove border * feat: add token colorErrorBgFilledHover * chore: add size-limit * refactor: rename --------- Signed-off-by: ice <49827327+coding-ice@users.noreply.github.com> Co-authored-by: lijianan <574980606@qq.com> Co-authored-by: MadCcc <1075746765@qq.com>
2024-09-03 17:39:02 +08:00
[`${prefixCls}-background-ghost`]: ghost && !isUnBorderedButtonVariant(mergedVariant),
[`${prefixCls}-loading`]: innerLoading,
[`${prefixCls}-two-chinese-chars`]: hasTwoCNChar && mergedInsertSpace && !innerLoading,
[`${prefixCls}-block`]: block,
[`${prefixCls}-rtl`]: direction === 'rtl',
[`${prefixCls}-icon-end`]: iconPosition === 'end',
},
feat: add Space.Compact (#37652) * feat: add Space.Compact * feat: update input style * feat: add CompactItem for context memoize * feat: add demo * feat: update button style * feat: update input style * feat: 提取 getCompactClassNames 公用方法 * feat: update button style * feat: update picker * feat: add block prop for Space.Compact * feat: use Space.Compact for Input#addonBefore/After * feat: update addon * refactor: compact * feat: update * feat: update * feat: migrate styles to compact for new Input/Input.Search * feat: organize input demo * feat: add more button compact demo * feat: resolve select border collapse * feat: fix input addon select style * feat: add input addon demo in Space * feat: add useCompactItemContext hook * feat: update compact-item style * feat: rollback input#addon implements * feat: rollback input#addon and input.search style * feat: select border collapse * feat: add Space.Compact demo * feat: Space.Compact vertical for Button * refactor: useCompactItemContext * feat: update Button vertical demo * feat: rtl for compact mixin * feat: rtl for compact button * feat: input rtl * feat: add docs for Space.Compact * test: add some tests for Space.Compact * test: add tests * feat: select style * feat: handle select focus style * feat: add useCompactItemContext for Picker and Cascader * style: add compact-item style for cascader * feat: support nested Space.Compact * style: Input.Search in Space.Compact * chore: clean * feat: add useCompactItemContext for TreeSelect * fix: lint issues * fix: style lint * docs: update demos for Space.Compact * docs: update demo * fix: add deps-lint-skip for space * fix: add deps-lint-skip for space * fix: handle edge case for useCompactItemContext * test: add search test case * chore: + bundlesize * style: merge button compact style into one file * style: improve style for nested compact * fix: stylelint * docs: update Space.Compact docs * test: update demo snapshot * test: update input debug test snapshot * docs: update doccs for Space.Compact * test: improve test cases for Compact * docs: clean demos for Compact * refactor: improve Space.Compact * fix: add useCompactItemContext for Input.Search * style: improve compact border-radius implementation * refactor: use context to make nested compact works * fix: input-number focused style * refactor: remove useless style * refactor: improve style for vertical compact * test: update snapshot * test: update snapshot for input * refactor: improve compact-item-border-radius * fix: search group in RTL * style: improve style for button compact * style: use after * fix: stylelint * chore: update snapshot * style: improve button compact * refactor: improve btn-icon-only style in compact
2022-10-18 16:23:10 +08:00
compactItemClassnames,
className,
rootClassName,
button?.className,
);
const fullStyle: React.CSSProperties = { ...button?.style, ...customStyle };
const iconClasses = classNames(customClassNames?.icon, button?.classNames?.icon);
const iconStyle: React.CSSProperties = {
...(styles?.icon || {}),
...(button?.styles?.icon || {}),
};
const iconNode =
2020-06-02 12:54:22 +08:00
icon && !innerLoading ? (
<IconWrapper prefixCls={prefixCls} className={iconClasses} style={iconStyle}>
{icon}
</IconWrapper>
) : (
2024-06-02 21:48:48 +08:00
<LoadingIcon existIcon={!!icon} prefixCls={prefixCls} loading={innerLoading} />
);
const kids =
children || children === 0 ? spaceChildren(children, needInserted && mergedInsertSpace) : null;
if (linkButtonRestProps.href !== undefined) {
return wrapCSSVar(
<a
{...linkButtonRestProps}
className={classNames(classes, {
[`${prefixCls}-disabled`]: mergedDisabled,
})}
href={mergedDisabled ? undefined : linkButtonRestProps.href}
style={fullStyle}
onClick={handleClick}
ref={mergedRef as React.Ref<HTMLAnchorElement>}
tabIndex={mergedDisabled ? -1 : 0}
>
{iconNode}
{kids}
</a>,
);
}
2019-08-05 18:38:10 +08:00
let buttonNode = (
<button
{...rest}
type={htmlType}
className={classes}
style={fullStyle}
onClick={handleClick}
disabled={mergedDisabled}
ref={mergedRef as React.Ref<HTMLButtonElement>}
>
{iconNode}
{kids}
{compactItemClassnames && <Compact prefixCls={prefixCls} />}
</button>
);
feat(Button): support variant and color (#50051) * feat(button): variant & color types * feat: type -> color/variant * feat: type -> color/variant * feat: add variant filled * test: snap * refactor(button): rename type -> variant * docs: add demo * feat: add danger ghost style * refactor: remove deprecated * refactor: eslint * docs: change color&variant * test: updated snap * docs: color-variant * docs: add debug color&variant * feat: global token * refactor: remove comment * docs: add color&variant docs * docs: remove default * docs: add space * docs: code * test: update snap * test: fix snap * test: btn querySelect * feat: change filled hoverStyle * test: fix * feat: support grey wave * refactor: enhance * docs: color/variant -> v 5.21 * test: snap * feat: add token * test: to do * test: fix test * ci: rebuild * style: remove * style: space * docs: add note & FQA * feat: add componentsToken * refactor: remove isNotGrey * test: add case * docs: tile button * test: snap * docs: site & snap * Update components/button/index.en-US.md Co-authored-by: lijianan <574980606@qq.com> Signed-off-by: ice <49827327+coding-ice@users.noreply.github.com> * fix: token color & undef * docs: site * docs: responsive * docs: enhance FAQ * docs: gap middle * test: snap * Update components/theme/interface/maps/colors.ts Co-authored-by: MadCcc <1075746765@qq.com> Signed-off-by: ice <49827327+coding-ice@users.noreply.github.com> * Update components/theme/interface/maps/colors.ts Co-authored-by: MadCcc <1075746765@qq.com> Signed-off-by: ice <49827327+coding-ice@users.noreply.github.com> * Update components/theme/interface/maps/colors.ts Co-authored-by: MadCcc <1075746765@qq.com> Signed-off-by: ice <49827327+coding-ice@users.noreply.github.com> * Update components/button/style/token.ts Co-authored-by: MadCcc <1075746765@qq.com> Signed-off-by: ice <49827327+coding-ice@users.noreply.github.com> * Update components/button/style/token.ts Co-authored-by: MadCcc <1075746765@qq.com> Signed-off-by: ice <49827327+coding-ice@users.noreply.github.com> * refactor: rename * docs: prettier * chore: eslint * refactor: cls * test: add solidTextColor case * refactor: genVariantButtonStyle * refactor: genVariantButtonStyle * refactor: genVariantButtonStyle * fix: rename * docs: text * fix: remove border * feat: add token colorErrorBgFilledHover * chore: add size-limit * refactor: rename --------- Signed-off-by: ice <49827327+coding-ice@users.noreply.github.com> Co-authored-by: lijianan <574980606@qq.com> Co-authored-by: MadCcc <1075746765@qq.com>
2024-09-03 17:39:02 +08:00
if (!isUnBorderedButtonVariant(mergedVariant)) {
buttonNode = (
<Wave component="Button" disabled={innerLoading}>
{buttonNode}
</Wave>
);
}
return wrapCSSVar(buttonNode);
});
type CompoundedComponent = typeof InternalCompoundedButton & {
Group: typeof Group;
/** @internal */
__ANT_BUTTON: boolean;
};
const Button = InternalCompoundedButton as CompoundedComponent;
Button.Group = Group;
Button.__ANT_BUTTON = true;
if (process.env.NODE_ENV !== 'production') {
Button.displayName = 'Button';
}
export default Button;