| import { FastColor } from '@ant-design/fast-color'; |
|
|
| import type { SharedComponentToken, SharedInputToken } from '../../input/style/token'; |
| import { initComponentToken } from '../../input/style/token'; |
| import type { FullToken, GetDefaultToken } from '../../theme/internal'; |
|
|
| export interface ComponentToken extends SharedComponentToken { |
| |
| |
| |
| |
| controlWidth: number; |
| |
| |
| |
| |
| handleWidth: number; |
| |
| |
| |
| |
| handleFontSize: number; |
| |
| |
| |
| |
| |
| handleVisible: 'auto' | true; |
| |
| |
| |
| |
| handleBg: string; |
| |
| |
| |
| |
| handleActiveBg: string; |
| |
| |
| |
| |
| handleHoverColor: string; |
| |
| |
| |
| |
| handleBorderColor: string; |
| |
| |
| |
| |
| filledHandleBg: string; |
| |
| |
| |
| handleOpacity: number; |
| |
| |
| |
| handleVisibleWidth: number; |
| } |
|
|
| export type InputNumberToken = FullToken<'InputNumber'> & SharedInputToken; |
|
|
| export const prepareComponentToken: GetDefaultToken<'InputNumber'> = (token) => { |
| const handleVisible = token.handleVisible ?? 'auto'; |
| const handleWidth = token.controlHeightSM - token.lineWidth * 2; |
|
|
| return { |
| ...initComponentToken(token), |
| controlWidth: 90, |
| handleWidth, |
| handleFontSize: token.fontSize / 2, |
| handleVisible, |
| handleActiveBg: token.colorFillAlter, |
| handleBg: token.colorBgContainer, |
| filledHandleBg: new FastColor(token.colorFillSecondary) |
| .onBackground(token.colorBgContainer) |
| .toHexString(), |
| handleHoverColor: token.colorPrimary, |
| handleBorderColor: token.colorBorder, |
| handleOpacity: handleVisible === true ? 1 : 0, |
| handleVisibleWidth: handleVisible === true ? handleWidth : 0, |
| }; |
| }; |
|
|