choerodon-ui
Version:
An enterprise-class UI design language and React-based implementation
39 lines (38 loc) • 1.25 kB
TypeScript
import React, { Component, CSSProperties, MouseEventHandler } from 'react';
import CheckableTag from './CheckableTag';
import { PresetColorType } from '../_util/colors';
import { LiteralUnion } from '../_util/type';
import { ConfigContextValue } from '../config-provider/ConfigContext';
export { CheckableTagProps } from './CheckableTag';
export interface TagProps {
prefixCls?: string;
className?: string;
color?: LiteralUnion<PresetColorType, string>;
/** 标签是否可以关闭 */
closable?: boolean;
/** 关闭时的回调 */
onClose?: Function;
/** 动画关闭后的回调 */
afterClose?: Function;
style?: CSSProperties;
}
export interface TagState {
closing: boolean;
closed: boolean;
}
export default class Tag extends Component<TagProps, TagState> {
static get contextType(): React.Context<ConfigContextValue>;
static displayName: string;
static CheckableTag: typeof CheckableTag;
static defaultProps: {
closable: boolean;
};
context: ConfigContextValue;
state: {
closing: boolean;
closed: boolean;
};
close: MouseEventHandler<HTMLElement>;
animationEnd: (_: string, existed: boolean) => void;
render(): JSX.Element;
}