2024-01-11 14:43:16 +08:00
|
|
|
import { unit } from '@ant-design/cssinjs';
|
|
|
|
|
2022-03-14 11:40:13 +08:00
|
|
|
import {
|
|
|
|
genBasicInputStyle,
|
|
|
|
genInputGroupStyle,
|
|
|
|
genPlaceholderStyle,
|
2023-09-22 13:55:54 +08:00
|
|
|
initInputToken,
|
2022-03-14 11:40:13 +08:00
|
|
|
} from '../../input/style';
|
2023-12-18 17:53:31 +08:00
|
|
|
import {
|
|
|
|
genBorderlessStyle,
|
|
|
|
genFilledGroupStyle,
|
|
|
|
genFilledStyle,
|
|
|
|
genOutlinedGroupStyle,
|
|
|
|
genOutlinedStyle,
|
|
|
|
} from '../../input/style/variants';
|
2022-07-11 15:35:58 +08:00
|
|
|
import { resetComponent, resetIcon } from '../../style';
|
2022-10-28 16:09:38 +08:00
|
|
|
import { genCompactItemStyle } from '../../style/compact-item';
|
2024-01-11 14:43:16 +08:00
|
|
|
import type { GenerateStyle } from '../../theme/internal';
|
2023-11-29 17:23:45 +08:00
|
|
|
import { genStyleHooks, mergeToken } from '../../theme/internal';
|
2024-01-11 14:43:16 +08:00
|
|
|
import type { ComponentToken, InputNumberToken } from './token';
|
2024-01-12 15:03:03 +08:00
|
|
|
import { prepareComponentToken } from './token';
|
2023-12-18 17:53:31 +08:00
|
|
|
|
|
|
|
export type { ComponentToken };
|
2022-03-14 11:40:13 +08:00
|
|
|
|
2023-07-31 13:22:27 +08:00
|
|
|
export const genRadiusStyle = (
|
|
|
|
{ componentCls, borderRadiusSM, borderRadiusLG }: InputNumberToken,
|
|
|
|
size: 'lg' | 'sm',
|
|
|
|
) => {
|
|
|
|
const borderRadius = size === 'lg' ? borderRadiusLG : borderRadiusSM;
|
|
|
|
return {
|
|
|
|
[`&-${size}`]: {
|
|
|
|
[`${componentCls}-handler-wrap`]: {
|
|
|
|
borderStartEndRadius: borderRadius,
|
|
|
|
borderEndEndRadius: borderRadius,
|
|
|
|
},
|
|
|
|
[`${componentCls}-handler-up`]: {
|
|
|
|
borderStartEndRadius: borderRadius,
|
|
|
|
},
|
|
|
|
[`${componentCls}-handler-down`]: {
|
|
|
|
borderEndEndRadius: borderRadius,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2022-03-14 11:40:13 +08:00
|
|
|
const genInputNumberStyles: GenerateStyle<InputNumberToken> = (token: InputNumberToken) => {
|
|
|
|
const {
|
2022-04-06 21:49:30 +08:00
|
|
|
componentCls,
|
2022-11-01 15:06:38 +08:00
|
|
|
lineWidth,
|
|
|
|
lineType,
|
|
|
|
borderRadius,
|
2024-06-12 15:55:18 +08:00
|
|
|
inputFontSizeSM,
|
|
|
|
inputFontSizeLG,
|
2022-03-14 11:40:13 +08:00
|
|
|
controlHeightLG,
|
|
|
|
controlHeightSM,
|
2022-03-22 09:37:37 +08:00
|
|
|
colorError,
|
2023-08-22 09:38:11 +08:00
|
|
|
paddingInlineSM,
|
2024-01-10 11:57:58 +08:00
|
|
|
paddingBlockSM,
|
|
|
|
paddingBlockLG,
|
|
|
|
paddingInlineLG,
|
2022-08-04 16:16:50 +08:00
|
|
|
colorTextDescription,
|
2022-11-17 23:31:41 +08:00
|
|
|
motionDurationMid,
|
2023-08-22 09:38:11 +08:00
|
|
|
handleHoverColor,
|
2024-07-10 14:43:39 +08:00
|
|
|
handleOpacity,
|
2023-08-22 09:38:11 +08:00
|
|
|
paddingInline,
|
|
|
|
paddingBlock,
|
|
|
|
handleBg,
|
|
|
|
handleActiveBg,
|
2022-03-29 15:57:39 +08:00
|
|
|
colorTextDisabled,
|
2022-11-01 15:06:38 +08:00
|
|
|
borderRadiusSM,
|
|
|
|
borderRadiusLG,
|
2022-03-29 15:57:39 +08:00
|
|
|
controlWidth,
|
2023-08-22 09:38:11 +08:00
|
|
|
handleBorderColor,
|
2023-12-18 17:53:31 +08:00
|
|
|
filledHandleBg,
|
2024-01-10 11:57:58 +08:00
|
|
|
lineHeightLG,
|
2023-11-13 17:45:45 +08:00
|
|
|
calc,
|
2022-03-14 11:40:13 +08:00
|
|
|
} = token;
|
|
|
|
|
2022-03-29 15:57:39 +08:00
|
|
|
return [
|
|
|
|
{
|
2022-04-06 21:49:30 +08:00
|
|
|
[componentCls]: {
|
2022-03-29 15:57:39 +08:00
|
|
|
...resetComponent(token),
|
|
|
|
...genBasicInputStyle(token),
|
2022-03-14 11:40:13 +08:00
|
|
|
|
2022-03-29 15:57:39 +08:00
|
|
|
display: 'inline-block',
|
|
|
|
width: controlWidth,
|
|
|
|
margin: 0,
|
|
|
|
padding: 0,
|
2022-11-01 15:06:38 +08:00
|
|
|
borderRadius,
|
2022-03-14 11:40:13 +08:00
|
|
|
|
2023-12-18 17:53:31 +08:00
|
|
|
// Variants
|
|
|
|
...genOutlinedStyle(token, {
|
|
|
|
[`${componentCls}-handler-wrap`]: {
|
|
|
|
background: handleBg,
|
|
|
|
[`${componentCls}-handler-down`]: {
|
|
|
|
borderBlockStart: `${unit(lineWidth)} ${lineType} ${handleBorderColor}`,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}),
|
|
|
|
...genFilledStyle(token, {
|
|
|
|
[`${componentCls}-handler-wrap`]: {
|
|
|
|
background: filledHandleBg,
|
|
|
|
[`${componentCls}-handler-down`]: {
|
|
|
|
borderBlockStart: `${unit(lineWidth)} ${lineType} ${handleBorderColor}`,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
'&:focus-within': {
|
|
|
|
[`${componentCls}-handler-wrap`]: {
|
|
|
|
background: handleBg,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}),
|
|
|
|
...genBorderlessStyle(token),
|
|
|
|
|
2022-03-29 15:57:39 +08:00
|
|
|
'&-rtl': {
|
2022-03-14 11:40:13 +08:00
|
|
|
direction: 'rtl',
|
|
|
|
|
2022-04-06 21:49:30 +08:00
|
|
|
[`${componentCls}-input`]: {
|
2022-03-29 15:57:39 +08:00
|
|
|
direction: 'rtl',
|
|
|
|
},
|
2022-03-14 11:40:13 +08:00
|
|
|
},
|
|
|
|
|
2022-03-29 15:57:39 +08:00
|
|
|
'&-lg': {
|
|
|
|
padding: 0,
|
2024-06-12 15:55:18 +08:00
|
|
|
fontSize: inputFontSizeLG,
|
2024-01-10 11:57:58 +08:00
|
|
|
lineHeight: lineHeightLG,
|
2022-11-01 15:06:38 +08:00
|
|
|
borderRadius: borderRadiusLG,
|
2022-03-14 11:40:13 +08:00
|
|
|
|
2022-04-06 21:49:30 +08:00
|
|
|
[`input${componentCls}-input`]: {
|
2023-11-13 17:45:45 +08:00
|
|
|
height: calc(controlHeightLG).sub(calc(lineWidth).mul(2)).equal(),
|
2024-01-10 11:57:58 +08:00
|
|
|
padding: `${unit(paddingBlockLG)} ${unit(paddingInlineLG)}`,
|
2022-03-29 15:57:39 +08:00
|
|
|
},
|
2022-03-14 11:40:13 +08:00
|
|
|
},
|
|
|
|
|
2022-03-29 15:57:39 +08:00
|
|
|
'&-sm': {
|
|
|
|
padding: 0,
|
2024-06-12 15:55:18 +08:00
|
|
|
fontSize: inputFontSizeSM,
|
2022-11-01 15:06:38 +08:00
|
|
|
borderRadius: borderRadiusSM,
|
2022-03-14 11:40:13 +08:00
|
|
|
|
2022-04-06 21:49:30 +08:00
|
|
|
[`input${componentCls}-input`]: {
|
2023-11-13 17:45:45 +08:00
|
|
|
height: calc(controlHeightSM).sub(calc(lineWidth).mul(2)).equal(),
|
2024-01-10 11:57:58 +08:00
|
|
|
padding: `${unit(paddingBlockSM)} ${unit(paddingInlineSM)}`,
|
2022-03-29 15:57:39 +08:00
|
|
|
},
|
2022-03-14 11:40:13 +08:00
|
|
|
},
|
|
|
|
|
2022-03-29 15:57:39 +08:00
|
|
|
// ===================== Out Of Range =====================
|
|
|
|
'&-out-of-range': {
|
2023-05-10 14:56:46 +08:00
|
|
|
[`${componentCls}-input-wrap`]: {
|
|
|
|
input: {
|
|
|
|
color: colorError,
|
|
|
|
},
|
2022-03-14 11:40:13 +08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
|
2022-03-29 15:57:39 +08:00
|
|
|
// Style for input-group: input with label, with button or dropdown...
|
|
|
|
'&-group': {
|
|
|
|
...resetComponent(token),
|
|
|
|
...genInputGroupStyle(token),
|
2022-03-14 11:40:13 +08:00
|
|
|
|
2022-03-29 15:57:39 +08:00
|
|
|
'&-wrapper': {
|
|
|
|
display: 'inline-block',
|
|
|
|
textAlign: 'start',
|
|
|
|
verticalAlign: 'top', // https://github.com/ant-design/ant-design/issues/6403
|
2022-03-14 11:40:13 +08:00
|
|
|
|
2022-04-06 21:49:30 +08:00
|
|
|
[`${componentCls}-affix-wrapper`]: {
|
2022-03-29 15:57:39 +08:00
|
|
|
width: '100%',
|
|
|
|
},
|
2022-08-19 10:10:51 +08:00
|
|
|
|
|
|
|
// Size
|
|
|
|
'&-lg': {
|
|
|
|
[`${componentCls}-group-addon`]: {
|
2022-11-01 15:06:38 +08:00
|
|
|
borderRadius: borderRadiusLG,
|
2023-08-04 18:24:03 +08:00
|
|
|
fontSize: token.fontSizeLG,
|
2022-08-19 10:10:51 +08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
'&-sm': {
|
|
|
|
[`${componentCls}-group-addon`]: {
|
2022-11-01 15:06:38 +08:00
|
|
|
borderRadius: borderRadiusSM,
|
2022-08-19 10:10:51 +08:00
|
|
|
},
|
|
|
|
},
|
2023-06-16 14:04:13 +08:00
|
|
|
|
2023-12-18 17:53:31 +08:00
|
|
|
// Variants
|
|
|
|
...genOutlinedGroupStyle(token),
|
|
|
|
...genFilledGroupStyle(token),
|
2023-11-28 17:11:23 +08:00
|
|
|
|
|
|
|
// Fix the issue of using icons in Space Compact mode
|
|
|
|
// https://github.com/ant-design/ant-design/issues/45764
|
|
|
|
[`&:not(${componentCls}-compact-first-item):not(${componentCls}-compact-last-item)${componentCls}-compact-item`]:
|
|
|
|
{
|
|
|
|
[`${componentCls}, ${componentCls}-group-addon`]: {
|
|
|
|
borderRadius: 0,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
[`&:not(${componentCls}-compact-last-item)${componentCls}-compact-first-item`]: {
|
|
|
|
[`${componentCls}, ${componentCls}-group-addon`]: {
|
|
|
|
borderStartEndRadius: 0,
|
|
|
|
borderEndEndRadius: 0,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
[`&:not(${componentCls}-compact-first-item)${componentCls}-compact-last-item`]: {
|
|
|
|
[`${componentCls}, ${componentCls}-group-addon`]: {
|
|
|
|
borderStartStartRadius: 0,
|
|
|
|
borderEndStartRadius: 0,
|
|
|
|
},
|
|
|
|
},
|
2022-03-14 11:40:13 +08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
|
2023-06-16 14:04:13 +08:00
|
|
|
[`&-disabled ${componentCls}-input`]: {
|
|
|
|
cursor: 'not-allowed',
|
|
|
|
},
|
|
|
|
|
2022-04-06 21:49:30 +08:00
|
|
|
[componentCls]: {
|
2022-03-29 15:57:39 +08:00
|
|
|
'&-input': {
|
2023-04-23 09:05:11 +08:00
|
|
|
...resetComponent(token),
|
2022-03-29 15:57:39 +08:00
|
|
|
width: '100%',
|
2023-11-13 17:45:45 +08:00
|
|
|
padding: `${unit(paddingBlock)} ${unit(paddingInline)}`,
|
2022-03-29 15:57:39 +08:00
|
|
|
textAlign: 'start',
|
|
|
|
backgroundColor: 'transparent',
|
|
|
|
border: 0,
|
2022-11-01 15:06:38 +08:00
|
|
|
borderRadius,
|
2022-03-29 15:57:39 +08:00
|
|
|
outline: 0,
|
2022-11-17 23:31:41 +08:00
|
|
|
transition: `all ${motionDurationMid} linear`,
|
2022-03-29 15:57:39 +08:00
|
|
|
appearance: 'textfield',
|
2023-04-25 18:58:52 +08:00
|
|
|
fontSize: 'inherit',
|
2022-06-17 18:47:47 +08:00
|
|
|
...genPlaceholderStyle(token.colorTextPlaceholder),
|
2022-03-29 15:57:39 +08:00
|
|
|
|
|
|
|
'&[type="number"]::-webkit-inner-spin-button, &[type="number"]::-webkit-outer-spin-button':
|
|
|
|
{
|
|
|
|
margin: 0,
|
|
|
|
webkitAppearance: 'none',
|
|
|
|
appearance: 'none',
|
|
|
|
},
|
|
|
|
},
|
2022-03-14 11:40:13 +08:00
|
|
|
},
|
2024-07-10 14:43:39 +08:00
|
|
|
[`&:hover ${componentCls}-handler-wrap, &-focused ${componentCls}-handler-wrap`]: {
|
|
|
|
width: token.handleWidth,
|
|
|
|
opacity: 1,
|
|
|
|
},
|
2022-03-29 15:57:39 +08:00
|
|
|
},
|
|
|
|
},
|
2022-03-14 11:40:13 +08:00
|
|
|
|
2022-03-29 15:57:39 +08:00
|
|
|
// Handler
|
|
|
|
{
|
2022-04-06 21:49:30 +08:00
|
|
|
[componentCls]: {
|
|
|
|
[`${componentCls}-handler-wrap`]: {
|
2022-03-14 11:40:13 +08:00
|
|
|
position: 'absolute',
|
|
|
|
insetBlockStart: 0,
|
|
|
|
insetInlineEnd: 0,
|
2024-07-10 14:43:39 +08:00
|
|
|
width: 0,
|
|
|
|
opacity: handleOpacity,
|
2022-03-14 11:40:13 +08:00
|
|
|
height: '100%',
|
|
|
|
borderStartStartRadius: 0,
|
2022-11-01 15:06:38 +08:00
|
|
|
borderStartEndRadius: borderRadius,
|
|
|
|
borderEndEndRadius: borderRadius,
|
2022-03-14 11:40:13 +08:00
|
|
|
borderEndStartRadius: 0,
|
2022-03-29 15:57:39 +08:00
|
|
|
display: 'flex',
|
|
|
|
flexDirection: 'column',
|
|
|
|
alignItems: 'stretch',
|
2024-07-10 14:43:39 +08:00
|
|
|
transition: `all ${motionDurationMid}`,
|
|
|
|
overflow: 'hidden',
|
2022-03-14 11:40:13 +08:00
|
|
|
|
|
|
|
// Fix input number inside Menu makes icon too large
|
|
|
|
// We arise the selector priority by nest selector here
|
|
|
|
// https://github.com/ant-design/ant-design/issues/14367
|
2022-04-06 21:49:30 +08:00
|
|
|
[`${componentCls}-handler`]: {
|
2022-03-29 15:57:39 +08:00
|
|
|
display: 'flex',
|
|
|
|
alignItems: 'center',
|
|
|
|
justifyContent: 'center',
|
|
|
|
flex: 'auto',
|
2022-03-14 11:40:13 +08:00
|
|
|
height: '40%',
|
2022-03-29 15:57:39 +08:00
|
|
|
|
|
|
|
[`
|
2022-04-06 21:49:30 +08:00
|
|
|
${componentCls}-handler-up-inner,
|
|
|
|
${componentCls}-handler-down-inner
|
2022-03-29 15:57:39 +08:00
|
|
|
`]: {
|
|
|
|
marginInlineEnd: 0,
|
|
|
|
fontSize: token.handleFontSize,
|
|
|
|
},
|
2022-03-14 11:40:13 +08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
|
2022-04-06 21:49:30 +08:00
|
|
|
[`${componentCls}-handler`]: {
|
2022-03-29 15:57:39 +08:00
|
|
|
height: '50%',
|
|
|
|
overflow: 'hidden',
|
2022-08-04 16:16:50 +08:00
|
|
|
color: colorTextDescription,
|
2022-03-29 15:57:39 +08:00
|
|
|
fontWeight: 'bold',
|
|
|
|
lineHeight: 0,
|
|
|
|
textAlign: 'center',
|
2022-03-14 11:40:13 +08:00
|
|
|
cursor: 'pointer',
|
2023-11-13 17:45:45 +08:00
|
|
|
borderInlineStart: `${unit(lineWidth)} ${lineType} ${handleBorderColor}`,
|
2022-11-17 23:31:41 +08:00
|
|
|
transition: `all ${motionDurationMid} linear`,
|
2022-03-29 15:57:39 +08:00
|
|
|
'&:active': {
|
2023-08-22 09:38:11 +08:00
|
|
|
background: handleActiveBg,
|
2022-03-14 11:40:13 +08:00
|
|
|
},
|
|
|
|
|
2022-03-29 15:57:39 +08:00
|
|
|
// Hover
|
2022-03-14 11:40:13 +08:00
|
|
|
'&:hover': {
|
2022-03-29 15:57:39 +08:00
|
|
|
height: `60%`,
|
|
|
|
|
|
|
|
[`
|
2022-04-06 21:49:30 +08:00
|
|
|
${componentCls}-handler-up-inner,
|
|
|
|
${componentCls}-handler-down-inner
|
2022-03-29 15:57:39 +08:00
|
|
|
`]: {
|
2023-08-22 09:38:11 +08:00
|
|
|
color: handleHoverColor,
|
2022-03-29 15:57:39 +08:00
|
|
|
},
|
2022-03-14 11:40:13 +08:00
|
|
|
},
|
|
|
|
|
2022-03-29 15:57:39 +08:00
|
|
|
'&-up-inner, &-down-inner': {
|
|
|
|
...resetIcon(),
|
2022-03-14 11:40:13 +08:00
|
|
|
|
2022-08-04 16:16:50 +08:00
|
|
|
color: colorTextDescription,
|
2022-11-17 23:31:41 +08:00
|
|
|
transition: `all ${motionDurationMid} linear`,
|
2022-03-29 15:57:39 +08:00
|
|
|
userSelect: 'none',
|
2022-03-14 11:40:13 +08:00
|
|
|
},
|
2022-03-29 15:57:39 +08:00
|
|
|
},
|
2022-03-14 11:40:13 +08:00
|
|
|
|
2022-04-06 21:49:30 +08:00
|
|
|
[`${componentCls}-handler-up`]: {
|
2022-11-01 15:06:38 +08:00
|
|
|
borderStartEndRadius: borderRadius,
|
2022-03-29 15:57:39 +08:00
|
|
|
},
|
|
|
|
|
2022-04-06 21:49:30 +08:00
|
|
|
[`${componentCls}-handler-down`]: {
|
2022-11-01 15:06:38 +08:00
|
|
|
borderEndEndRadius: borderRadius,
|
2022-03-29 15:57:39 +08:00
|
|
|
},
|
2022-03-14 11:40:13 +08:00
|
|
|
|
2023-07-31 13:22:27 +08:00
|
|
|
...genRadiusStyle(token, 'lg'),
|
|
|
|
...genRadiusStyle(token, 'sm'),
|
|
|
|
|
2022-03-29 15:57:39 +08:00
|
|
|
// Disabled
|
|
|
|
'&-disabled, &-readonly': {
|
2022-04-06 21:49:30 +08:00
|
|
|
[`${componentCls}-handler-wrap`]: {
|
2022-03-29 15:57:39 +08:00
|
|
|
display: 'none',
|
2022-03-14 11:40:13 +08:00
|
|
|
},
|
2023-03-10 20:31:06 +08:00
|
|
|
|
|
|
|
[`${componentCls}-input`]: {
|
|
|
|
color: 'inherit',
|
|
|
|
},
|
2022-03-14 11:40:13 +08:00
|
|
|
},
|
2022-03-29 15:57:39 +08:00
|
|
|
|
|
|
|
[`
|
2022-04-06 21:49:30 +08:00
|
|
|
${componentCls}-handler-up-disabled,
|
|
|
|
${componentCls}-handler-down-disabled
|
2022-03-29 15:57:39 +08:00
|
|
|
`]: {
|
2022-03-14 11:40:13 +08:00
|
|
|
cursor: 'not-allowed',
|
|
|
|
},
|
|
|
|
|
2022-03-29 15:57:39 +08:00
|
|
|
[`
|
2022-04-06 21:49:30 +08:00
|
|
|
${componentCls}-handler-up-disabled:hover &-handler-up-inner,
|
|
|
|
${componentCls}-handler-down-disabled:hover &-handler-down-inner
|
2022-03-29 15:57:39 +08:00
|
|
|
`]: {
|
|
|
|
color: colorTextDisabled,
|
2022-03-14 11:40:13 +08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2022-03-29 15:57:39 +08:00
|
|
|
];
|
2022-03-14 11:40:13 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
const genAffixWrapperStyles: GenerateStyle<InputNumberToken> = (token: InputNumberToken) => {
|
2022-08-19 10:10:51 +08:00
|
|
|
const {
|
|
|
|
componentCls,
|
2023-08-22 09:38:11 +08:00
|
|
|
paddingBlock,
|
|
|
|
paddingInline,
|
2022-08-19 10:10:51 +08:00
|
|
|
inputAffixPadding,
|
|
|
|
controlWidth,
|
2022-11-01 15:06:38 +08:00
|
|
|
borderRadiusLG,
|
|
|
|
borderRadiusSM,
|
2024-01-10 11:57:58 +08:00
|
|
|
paddingInlineLG,
|
|
|
|
paddingInlineSM,
|
|
|
|
paddingBlockLG,
|
|
|
|
paddingBlockSM,
|
2024-07-10 14:43:39 +08:00
|
|
|
motionDurationMid,
|
2022-08-19 10:10:51 +08:00
|
|
|
} = token;
|
2022-03-14 11:40:13 +08:00
|
|
|
|
|
|
|
return {
|
2022-04-06 21:49:30 +08:00
|
|
|
[`${componentCls}-affix-wrapper`]: {
|
2024-01-10 11:57:58 +08:00
|
|
|
[`input${componentCls}-input`]: {
|
|
|
|
padding: `${unit(paddingBlock)} 0`,
|
|
|
|
},
|
|
|
|
|
2022-03-14 20:57:01 +08:00
|
|
|
...genBasicInputStyle(token),
|
2022-03-14 11:40:13 +08:00
|
|
|
// or number handler will cover form status
|
|
|
|
position: 'relative',
|
|
|
|
display: 'inline-flex',
|
2024-07-10 14:43:39 +08:00
|
|
|
alignItems: 'center',
|
2022-03-29 15:57:39 +08:00
|
|
|
width: controlWidth,
|
2022-03-14 11:40:13 +08:00
|
|
|
padding: 0,
|
2023-08-22 09:38:11 +08:00
|
|
|
paddingInlineStart: paddingInline,
|
2022-03-14 11:40:13 +08:00
|
|
|
|
2022-08-19 10:10:51 +08:00
|
|
|
'&-lg': {
|
2022-11-01 15:06:38 +08:00
|
|
|
borderRadius: borderRadiusLG,
|
2024-01-10 11:57:58 +08:00
|
|
|
paddingInlineStart: paddingInlineLG,
|
|
|
|
|
|
|
|
[`input${componentCls}-input`]: {
|
|
|
|
padding: `${unit(paddingBlockLG)} 0`,
|
|
|
|
},
|
2022-08-19 10:10:51 +08:00
|
|
|
},
|
|
|
|
|
|
|
|
'&-sm': {
|
2022-11-01 15:06:38 +08:00
|
|
|
borderRadius: borderRadiusSM,
|
2024-01-10 11:57:58 +08:00
|
|
|
paddingInlineStart: paddingInlineSM,
|
|
|
|
|
|
|
|
[`input${componentCls}-input`]: {
|
|
|
|
padding: `${unit(paddingBlockSM)} 0`,
|
|
|
|
},
|
2022-08-19 10:10:51 +08:00
|
|
|
},
|
|
|
|
|
2023-12-18 17:53:31 +08:00
|
|
|
[`&:not(${componentCls}-disabled):hover`]: {
|
2022-03-14 11:40:13 +08:00
|
|
|
zIndex: 1,
|
|
|
|
},
|
|
|
|
|
|
|
|
'&-focused, &:focus': {
|
|
|
|
zIndex: 1,
|
|
|
|
},
|
|
|
|
|
2023-06-16 14:04:13 +08:00
|
|
|
[`&-disabled > ${componentCls}-disabled`]: {
|
|
|
|
background: 'transparent',
|
2022-03-14 11:40:13 +08:00
|
|
|
},
|
|
|
|
|
2022-04-06 21:49:30 +08:00
|
|
|
[`> div${componentCls}`]: {
|
2022-03-14 11:40:13 +08:00
|
|
|
width: '100%',
|
|
|
|
border: 'none',
|
|
|
|
outline: 'none',
|
|
|
|
|
2022-04-06 21:49:30 +08:00
|
|
|
[`&${componentCls}-focused`]: {
|
2022-03-14 11:40:13 +08:00
|
|
|
boxShadow: 'none !important',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
'&::before': {
|
2023-06-16 18:56:14 +08:00
|
|
|
display: 'inline-block',
|
2022-03-14 11:40:13 +08:00
|
|
|
width: 0,
|
|
|
|
visibility: 'hidden',
|
|
|
|
content: '"\\a0"',
|
|
|
|
},
|
|
|
|
|
2022-04-06 21:49:30 +08:00
|
|
|
[`${componentCls}-handler-wrap`]: {
|
2022-03-14 11:40:13 +08:00
|
|
|
zIndex: 2,
|
|
|
|
},
|
|
|
|
|
2022-04-06 21:49:30 +08:00
|
|
|
[componentCls]: {
|
2024-07-10 14:43:39 +08:00
|
|
|
position: 'static',
|
2023-12-18 17:53:31 +08:00
|
|
|
color: 'inherit',
|
|
|
|
|
2022-03-14 11:40:13 +08:00
|
|
|
'&-prefix, &-suffix': {
|
|
|
|
display: 'flex',
|
|
|
|
flex: 'none',
|
|
|
|
alignItems: 'center',
|
|
|
|
pointerEvents: 'none',
|
|
|
|
},
|
|
|
|
|
|
|
|
'&-prefix': {
|
2022-03-29 15:57:39 +08:00
|
|
|
marginInlineEnd: inputAffixPadding,
|
2022-03-14 11:40:13 +08:00
|
|
|
},
|
|
|
|
|
|
|
|
'&-suffix': {
|
|
|
|
insetBlockStart: 0,
|
|
|
|
insetInlineEnd: 0,
|
|
|
|
height: '100%',
|
2023-08-22 09:38:11 +08:00
|
|
|
marginInlineEnd: paddingInline,
|
2022-03-29 15:57:39 +08:00
|
|
|
marginInlineStart: inputAffixPadding,
|
2024-07-10 14:43:39 +08:00
|
|
|
transition: `margin ${motionDurationMid}`,
|
2022-03-14 11:40:13 +08:00
|
|
|
},
|
|
|
|
},
|
2024-07-10 14:43:39 +08:00
|
|
|
|
|
|
|
[`&:hover ${componentCls}-handler-wrap, &-focused ${componentCls}-handler-wrap`]: {
|
|
|
|
width: token.handleWidth,
|
|
|
|
opacity: 1,
|
|
|
|
},
|
2024-08-16 20:07:26 +08:00
|
|
|
[`&:not(${componentCls}-affix-wrapper-without-controls):hover ${componentCls}-suffix`]: {
|
2024-07-10 14:43:39 +08:00
|
|
|
marginInlineEnd: token.calc(token.handleWidth).add(paddingInline).equal(),
|
|
|
|
},
|
2022-03-14 11:40:13 +08:00
|
|
|
},
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2023-11-29 17:23:45 +08:00
|
|
|
export default genStyleHooks(
|
2022-04-06 21:49:30 +08:00
|
|
|
'InputNumber',
|
2022-11-17 23:31:41 +08:00
|
|
|
(token) => {
|
2023-08-22 09:38:11 +08:00
|
|
|
const inputNumberToken = mergeToken<InputNumberToken>(token, initInputToken(token));
|
2022-12-12 16:36:46 +08:00
|
|
|
return [
|
|
|
|
genInputNumberStyles(inputNumberToken),
|
|
|
|
genAffixWrapperStyles(inputNumberToken),
|
|
|
|
// =====================================================
|
|
|
|
// == Space Compact ==
|
|
|
|
// =====================================================
|
|
|
|
genCompactItemStyle(inputNumberToken),
|
|
|
|
];
|
2022-04-06 21:49:30 +08:00
|
|
|
},
|
2023-11-13 17:45:45 +08:00
|
|
|
prepareComponentToken,
|
2023-11-22 20:53:48 +08:00
|
|
|
{
|
2023-11-29 17:23:45 +08:00
|
|
|
unitless: {
|
|
|
|
handleOpacity: true,
|
|
|
|
},
|
2023-11-22 20:53:48 +08:00
|
|
|
},
|
2022-04-06 21:49:30 +08:00
|
|
|
);
|