import * as React from 'react'; import StarFilled from '@ant-design/icons/StarFilled'; import classNames from 'classnames'; import RcRate from 'rc-rate'; import type { RateRef, RateProps as RcRateProps } from 'rc-rate/lib/Rate'; import type { StarProps as RcStarProps } from 'rc-rate/lib/Star'; import { ConfigContext } from '../config-provider'; import Tooltip from '../tooltip'; import useStyle from './style'; export interface RateProps extends RcRateProps { rootClassName?: string; tooltips?: Array; } const Rate = React.forwardRef((props, ref) => { const { prefixCls, className, rootClassName, style, tooltips, character = , ...rest } = props; const characterRender: RcStarProps['characterRender'] = (node, { index }) => { if (!tooltips) { return node; } return {node}; }; const { getPrefixCls, direction, rate } = React.useContext(ConfigContext); const ratePrefixCls = getPrefixCls('rate', prefixCls); // Style const [wrapCSSVar, hashId, cssVarCls] = useStyle(ratePrefixCls); const mergedStyle: React.CSSProperties = { ...rate?.style, ...style }; return wrapCSSVar( , ); }); if (process.env.NODE_ENV !== 'production') { Rate.displayName = 'Rate'; } export default Rate;