import ConfigProvider from '../config-provider'; import PropTypes from 'prop-types'; import React, { Component } from 'react'; import cls from 'classnames'; import { CommonThemeProps } from '../types'; import { CloseableProps as NextCloseableProps } from '@alifd/next/types/tag'; import { SelectableProps as NextSelectableProps } from '@alifd/next/types/tag'; import { Tag as NextTag } from '@alifd/next'; import { TagProps as NextTagProps } from '@alifd/next/types/tag'; import { getTheme } from '../utils/getTheme'; import { omitProps } from '../utils/object'; interface CloseableProps extends Omit, CommonThemeProps { size?: 'large' | 'medium' | 'small' | 'xs'; } class Closeable extends Component { static contextTypes = { theme: PropTypes.string, }; render() { const { prefix = 'next-', size = 'medium', className, ...otherProps } = this.props; const theme = getTheme(this.context, this.props); if (size === 'xs') { return ( ); } return ( ); } } interface SelectableProps extends Omit, CommonThemeProps { size?: 'large' | 'medium' | 'small' | 'xs'; } class Selectable extends Component { static contextTypes = { theme: PropTypes.string, }; render() { const { prefix = 'next-', size = 'medium', className, ...otherProps } = this.props; const theme = getTheme(this.context, this.props); if (size === 'xs') { return ( ); } return ( ); } } interface TagProps extends Omit, CommonThemeProps { size?: 'large' | 'medium' | 'small' | 'xs'; } class Tag extends Component { static Group = NextTag.Group; static Closeable = ConfigProvider.config(Closeable); static Selectable = ConfigProvider.config(Selectable); static contextTypes = { theme: PropTypes.string, }; render() { const { prefix = 'next-', size = 'medium', className, color, ...otherProps } = this.props; const theme = getTheme(this.context, this.props); if (size === 'xs') { return ( ); } return ( ); } } export default ConfigProvider.config(Tag);