2022-05-09 22:20:07 +08:00
|
|
|
import type { CSSObject } from '@ant-design/cssinjs';
|
2022-06-27 14:25:59 +08:00
|
|
|
import type { FullToken, GenerateStyle } from '../../theme';
|
2022-07-11 15:35:58 +08:00
|
|
|
import { genComponentStyleHook, mergeToken } from '../../theme';
|
2022-06-27 14:25:59 +08:00
|
|
|
import type { GlobalToken } from '../../theme/interface';
|
2022-07-11 15:35:58 +08:00
|
|
|
import { clearFix, resetComponent } from '../../style';
|
2022-10-28 16:09:38 +08:00
|
|
|
import { genCompactItemStyle } from '../../style/compact-item';
|
2022-04-06 21:49:30 +08:00
|
|
|
|
|
|
|
export type InputToken<T extends GlobalToken = FullToken<'Input'>> = T & {
|
2022-03-29 15:57:39 +08:00
|
|
|
inputAffixPadding: number;
|
2022-03-09 10:38:02 +08:00
|
|
|
inputPaddingVertical: number;
|
|
|
|
inputPaddingVerticalLG: number;
|
|
|
|
inputPaddingVerticalSM: number;
|
|
|
|
inputPaddingHorizontal: number;
|
2022-03-29 15:57:39 +08:00
|
|
|
inputPaddingHorizontalSM: number;
|
2022-03-09 10:38:02 +08:00
|
|
|
inputBorderHoverColor: string;
|
|
|
|
inputBorderActiveColor: string;
|
2022-04-06 21:49:30 +08:00
|
|
|
};
|
2022-03-09 10:38:02 +08:00
|
|
|
|
2022-03-29 15:57:39 +08:00
|
|
|
export const genPlaceholderStyle = (color: string): CSSObject => ({
|
2022-03-09 10:38:02 +08:00
|
|
|
// Firefox
|
|
|
|
'&::-moz-placeholder': {
|
|
|
|
opacity: 1,
|
|
|
|
},
|
|
|
|
'&::placeholder': {
|
|
|
|
color,
|
|
|
|
userSelect: 'none', // https://github.com/ant-design/ant-design/pull/32639
|
|
|
|
},
|
|
|
|
'&:placeholder-shown': {
|
|
|
|
textOverflow: 'ellipsis',
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
export const genHoverStyle = (token: InputToken): CSSObject => ({
|
|
|
|
borderColor: token.inputBorderHoverColor,
|
2022-11-01 15:06:38 +08:00
|
|
|
borderInlineEndWidth: token.lineWidth,
|
2022-03-09 10:38:02 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
export const genActiveStyle = (token: InputToken) => ({
|
|
|
|
borderColor: token.inputBorderHoverColor,
|
2022-07-21 17:00:42 +08:00
|
|
|
boxShadow: `0 0 0 ${token.controlOutlineWidth}px ${token.controlOutline}`,
|
2022-11-01 15:06:38 +08:00
|
|
|
borderInlineEndWidth: token.lineWidth,
|
2022-03-09 10:38:02 +08:00
|
|
|
outline: 0,
|
|
|
|
});
|
|
|
|
|
|
|
|
export const genDisabledStyle = (token: InputToken): CSSObject => ({
|
2022-03-22 13:26:29 +08:00
|
|
|
color: token.colorTextDisabled,
|
2022-06-28 20:33:01 +08:00
|
|
|
backgroundColor: token.colorBgContainerDisabled,
|
2022-03-22 13:26:29 +08:00
|
|
|
borderColor: token.colorBorder,
|
2022-03-09 10:38:02 +08:00
|
|
|
boxShadow: 'none',
|
|
|
|
cursor: 'not-allowed',
|
|
|
|
opacity: 1,
|
|
|
|
|
|
|
|
'&:hover': {
|
2022-04-11 16:04:00 +08:00
|
|
|
...genHoverStyle(mergeToken<InputToken>(token, { inputBorderHoverColor: token.colorBorder })),
|
2022-03-09 10:38:02 +08:00
|
|
|
},
|
|
|
|
});
|
|
|
|
|
2022-03-14 20:57:01 +08:00
|
|
|
const genInputLargeStyle = (token: InputToken): CSSObject => {
|
2022-11-01 15:06:38 +08:00
|
|
|
const { inputPaddingVerticalLG, inputPaddingHorizontal, fontSizeLG, borderRadiusLG } = token;
|
2022-03-09 10:38:02 +08:00
|
|
|
|
2022-03-14 20:57:01 +08:00
|
|
|
return {
|
|
|
|
padding: `${inputPaddingVerticalLG}px ${inputPaddingHorizontal}px`,
|
|
|
|
fontSize: fontSizeLG,
|
2022-11-01 15:06:38 +08:00
|
|
|
borderRadius: borderRadiusLG,
|
2022-03-14 20:57:01 +08:00
|
|
|
};
|
|
|
|
};
|
2022-03-09 10:38:02 +08:00
|
|
|
|
2022-03-30 13:54:21 +08:00
|
|
|
export const genInputSmallStyle = (token: InputToken): CSSObject => ({
|
2022-03-25 17:54:57 +08:00
|
|
|
padding: `${token.inputPaddingVerticalSM}px ${token.controlPaddingHorizontalSM - 1}px`,
|
2022-11-01 15:06:38 +08:00
|
|
|
borderRadius: token.borderRadiusSM,
|
2022-03-09 10:38:02 +08:00
|
|
|
});
|
|
|
|
|
2022-03-14 20:57:01 +08:00
|
|
|
export const genStatusStyle = (token: InputToken): CSSObject => {
|
2022-09-20 21:50:36 +08:00
|
|
|
const {
|
|
|
|
prefixCls,
|
|
|
|
colorError,
|
|
|
|
colorWarning,
|
|
|
|
colorErrorOutline,
|
|
|
|
colorWarningOutline,
|
|
|
|
colorErrorBorderHover,
|
|
|
|
colorWarningBorderHover,
|
|
|
|
} = token;
|
2022-03-09 10:38:02 +08:00
|
|
|
|
2022-03-14 20:57:01 +08:00
|
|
|
return {
|
|
|
|
'&-status-error:not(&-disabled):not(&-borderless)&': {
|
2022-09-20 21:50:36 +08:00
|
|
|
borderColor: colorError,
|
|
|
|
|
|
|
|
'&:hover': {
|
|
|
|
borderColor: colorErrorBorderHover,
|
2022-03-14 20:57:01 +08:00
|
|
|
},
|
2022-03-09 10:38:02 +08:00
|
|
|
|
2022-03-14 20:57:01 +08:00
|
|
|
'&:focus, &-focused': {
|
2022-04-11 16:04:00 +08:00
|
|
|
...genActiveStyle(
|
|
|
|
mergeToken<InputToken>(token, {
|
|
|
|
inputBorderActiveColor: colorError,
|
|
|
|
inputBorderHoverColor: colorError,
|
2022-07-21 17:00:42 +08:00
|
|
|
controlOutline: colorErrorOutline,
|
2022-04-11 16:04:00 +08:00
|
|
|
}),
|
|
|
|
),
|
2022-03-14 20:57:01 +08:00
|
|
|
},
|
2022-03-09 10:38:02 +08:00
|
|
|
|
2022-03-25 20:08:05 +08:00
|
|
|
[`.${prefixCls}-prefix`]: {
|
2022-03-22 09:37:37 +08:00
|
|
|
color: colorError,
|
2022-03-14 20:57:01 +08:00
|
|
|
},
|
2022-03-09 10:38:02 +08:00
|
|
|
},
|
2022-03-14 20:57:01 +08:00
|
|
|
'&-status-warning:not(&-disabled):not(&-borderless)&': {
|
2022-09-20 21:50:36 +08:00
|
|
|
borderColor: colorWarning,
|
|
|
|
|
|
|
|
'&:hover': {
|
|
|
|
borderColor: colorWarningBorderHover,
|
2022-03-14 20:57:01 +08:00
|
|
|
},
|
|
|
|
|
|
|
|
'&:focus, &-focused': {
|
2022-04-11 16:04:00 +08:00
|
|
|
...genActiveStyle(
|
|
|
|
mergeToken<InputToken>(token, {
|
|
|
|
inputBorderActiveColor: colorWarning,
|
|
|
|
inputBorderHoverColor: colorWarning,
|
2022-07-21 17:00:42 +08:00
|
|
|
controlOutline: colorWarningOutline,
|
2022-04-11 16:04:00 +08:00
|
|
|
}),
|
|
|
|
),
|
2022-03-14 20:57:01 +08:00
|
|
|
},
|
2022-03-09 10:38:02 +08:00
|
|
|
|
2022-03-25 20:08:05 +08:00
|
|
|
[`.${prefixCls}-prefix`]: {
|
2022-03-22 09:37:37 +08:00
|
|
|
color: colorWarning,
|
2022-03-14 20:57:01 +08:00
|
|
|
},
|
2022-03-09 10:38:02 +08:00
|
|
|
},
|
2022-03-14 20:57:01 +08:00
|
|
|
};
|
|
|
|
};
|
2022-03-09 10:38:02 +08:00
|
|
|
|
2022-03-14 20:57:01 +08:00
|
|
|
export const genBasicInputStyle = (token: InputToken): CSSObject => ({
|
2022-03-09 10:38:02 +08:00
|
|
|
position: 'relative',
|
|
|
|
display: 'inline-block',
|
|
|
|
width: '100%',
|
|
|
|
minWidth: 0,
|
|
|
|
padding: `${token.inputPaddingVertical}px ${token.inputPaddingHorizontal}px`,
|
2022-03-22 09:37:37 +08:00
|
|
|
color: token.colorText,
|
2022-03-09 10:38:02 +08:00
|
|
|
fontSize: token.fontSize,
|
|
|
|
lineHeight: token.lineHeight,
|
2022-06-28 20:33:01 +08:00
|
|
|
backgroundColor: token.colorBgContainer,
|
2022-03-09 10:38:02 +08:00
|
|
|
backgroundImage: 'none',
|
2022-11-01 15:06:38 +08:00
|
|
|
borderWidth: token.lineWidth,
|
|
|
|
borderStyle: token.lineType,
|
2022-03-22 13:26:29 +08:00
|
|
|
borderColor: token.colorBorder,
|
2022-11-01 15:06:38 +08:00
|
|
|
borderRadius: token.borderRadius,
|
2022-09-07 14:08:14 +08:00
|
|
|
transition: `all ${token.motionDurationFast}`,
|
2022-06-17 18:47:47 +08:00
|
|
|
...genPlaceholderStyle(token.colorTextPlaceholder),
|
2022-03-09 10:38:02 +08:00
|
|
|
|
|
|
|
'&:hover': {
|
|
|
|
...genHoverStyle(token),
|
|
|
|
},
|
|
|
|
|
|
|
|
'&:focus, &-focused': {
|
|
|
|
...genActiveStyle(token),
|
|
|
|
},
|
|
|
|
|
2022-03-14 11:40:13 +08:00
|
|
|
'&-disabled, &[disabled]': {
|
2022-03-09 10:38:02 +08:00
|
|
|
...genDisabledStyle(token),
|
|
|
|
},
|
|
|
|
|
|
|
|
'&-borderless': {
|
|
|
|
'&, &:hover, &:focus, &-focused, &-disabled, &[disabled]': {
|
|
|
|
backgroundColor: 'transparent',
|
|
|
|
border: 'none',
|
|
|
|
boxShadow: 'none',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
// Reset height for `textarea`s
|
|
|
|
'textarea&': {
|
|
|
|
maxWidth: '100%', // prevent textearea resize from coming out of its container
|
|
|
|
height: 'auto',
|
|
|
|
minHeight: token.controlHeight,
|
|
|
|
lineHeight: token.lineHeight,
|
|
|
|
verticalAlign: 'bottom',
|
2022-03-22 20:02:04 +08:00
|
|
|
transition: `all ${token.motionDurationSlow}, height 0s`,
|
2022-03-09 10:38:02 +08:00
|
|
|
},
|
|
|
|
|
|
|
|
'&-textarea': {
|
|
|
|
'&-rtl': {
|
|
|
|
direction: 'rtl',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
// Size
|
|
|
|
'&-lg': {
|
2022-03-14 20:57:01 +08:00
|
|
|
...genInputLargeStyle(token),
|
2022-03-09 10:38:02 +08:00
|
|
|
},
|
|
|
|
'&-sm': {
|
|
|
|
...genInputSmallStyle(token),
|
|
|
|
},
|
|
|
|
|
|
|
|
'&-rtl': {
|
|
|
|
direction: 'rtl',
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
2022-03-14 20:57:01 +08:00
|
|
|
export const genInputGroupStyle = (token: InputToken): CSSObject => {
|
2022-08-08 15:50:49 +08:00
|
|
|
const { prefixCls, antCls } = token;
|
2022-03-09 10:38:02 +08:00
|
|
|
|
2022-03-14 20:57:01 +08:00
|
|
|
return {
|
|
|
|
position: 'relative',
|
|
|
|
display: 'table',
|
|
|
|
width: '100%',
|
|
|
|
borderCollapse: 'separate',
|
|
|
|
borderSpacing: 0,
|
2022-03-09 10:38:02 +08:00
|
|
|
|
2022-03-14 20:57:01 +08:00
|
|
|
// Undo padding and float of grid classes
|
|
|
|
[`&[class*='col-']`]: {
|
|
|
|
paddingInlineEnd: token.paddingXS,
|
2022-03-09 10:38:02 +08:00
|
|
|
|
2022-03-14 20:57:01 +08:00
|
|
|
'&:last-child': {
|
|
|
|
paddingInlineEnd: 0,
|
|
|
|
},
|
|
|
|
},
|
2022-03-09 10:38:02 +08:00
|
|
|
|
2022-03-14 20:57:01 +08:00
|
|
|
// Sizing options
|
|
|
|
[`&-lg .${prefixCls}, &-lg > .${prefixCls}-group-addon`]: {
|
|
|
|
...genInputLargeStyle(token),
|
|
|
|
},
|
2022-03-09 10:38:02 +08:00
|
|
|
|
2022-03-14 20:57:01 +08:00
|
|
|
[`&-sm .${prefixCls}, &-sm > .${prefixCls}-group-addon`]: {
|
|
|
|
...genInputSmallStyle(token),
|
|
|
|
},
|
2022-03-09 10:38:02 +08:00
|
|
|
|
2022-03-14 20:57:01 +08:00
|
|
|
// Fix https://github.com/ant-design/ant-design/issues/5754
|
2022-08-08 15:50:49 +08:00
|
|
|
[`&-lg ${antCls}-select-single ${antCls}-select-selector`]: {
|
2022-03-14 20:57:01 +08:00
|
|
|
height: token.controlHeightLG,
|
|
|
|
},
|
2022-03-09 10:38:02 +08:00
|
|
|
|
2022-08-08 15:50:49 +08:00
|
|
|
[`&-sm ${antCls}-select-single ${antCls}-select-selector`]: {
|
2022-03-14 20:57:01 +08:00
|
|
|
height: token.controlHeightSM,
|
2022-03-09 10:38:02 +08:00
|
|
|
},
|
|
|
|
|
2022-03-14 20:57:01 +08:00
|
|
|
[`> .${prefixCls}`]: {
|
2022-03-09 10:38:02 +08:00
|
|
|
display: 'table-cell',
|
|
|
|
|
|
|
|
'&:not(:first-child):not(:last-child)': {
|
|
|
|
borderRadius: 0,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
2022-03-14 20:57:01 +08:00
|
|
|
[`.${prefixCls}-group`]: {
|
|
|
|
[`&-addon, &-wrap`]: {
|
|
|
|
display: 'table-cell',
|
2022-03-29 15:57:39 +08:00
|
|
|
width: 1,
|
2022-03-14 20:57:01 +08:00
|
|
|
whiteSpace: 'nowrap',
|
|
|
|
verticalAlign: 'middle',
|
|
|
|
|
|
|
|
'&:not(:first-child):not(:last-child)': {
|
|
|
|
borderRadius: 0,
|
|
|
|
},
|
|
|
|
},
|
2022-03-09 10:38:02 +08:00
|
|
|
|
2022-03-14 20:57:01 +08:00
|
|
|
'&-wrap > *': {
|
|
|
|
display: 'block !important',
|
|
|
|
},
|
2022-03-09 10:38:02 +08:00
|
|
|
|
2022-03-14 20:57:01 +08:00
|
|
|
'&-addon': {
|
|
|
|
position: 'relative',
|
|
|
|
padding: `0 ${token.inputPaddingHorizontal}px`,
|
2022-03-22 09:37:37 +08:00
|
|
|
color: token.colorText,
|
2022-03-14 20:57:01 +08:00
|
|
|
fontWeight: 'normal',
|
|
|
|
fontSize: token.fontSize,
|
|
|
|
textAlign: 'center',
|
2022-07-21 17:00:42 +08:00
|
|
|
backgroundColor: token.colorFillAlter,
|
2022-11-01 15:06:38 +08:00
|
|
|
border: `${token.lineWidth}px ${token.lineType} ${token.colorBorder}`,
|
|
|
|
borderRadius: token.borderRadius,
|
2022-03-22 20:02:04 +08:00
|
|
|
transition: `all ${token.motionDurationSlow}`,
|
2022-03-14 20:57:01 +08:00
|
|
|
|
|
|
|
// Reset Select's style in addon
|
2022-08-08 15:50:49 +08:00
|
|
|
[`${antCls}-select`]: {
|
2022-03-14 20:57:01 +08:00
|
|
|
margin: `-${token.inputPaddingVertical + 1}px -${token.inputPaddingHorizontal}px`,
|
|
|
|
|
2022-08-08 15:50:49 +08:00
|
|
|
[`&${antCls}-select-single:not(${antCls}-select-customize-input)`]: {
|
|
|
|
[`${antCls}-select-selector`]: {
|
2022-03-14 20:57:01 +08:00
|
|
|
backgroundColor: 'inherit',
|
2022-11-01 15:06:38 +08:00
|
|
|
border: `${token.lineWidth}px ${token.lineType} transparent`,
|
2022-03-14 20:57:01 +08:00
|
|
|
boxShadow: 'none',
|
|
|
|
},
|
|
|
|
},
|
2022-03-09 10:38:02 +08:00
|
|
|
|
2022-03-14 20:57:01 +08:00
|
|
|
'&-open, &-focused': {
|
2022-08-08 15:50:49 +08:00
|
|
|
[`${antCls}-select-selector`]: {
|
2022-03-22 09:37:37 +08:00
|
|
|
color: token.colorPrimary,
|
2022-03-14 20:57:01 +08:00
|
|
|
},
|
2022-03-09 10:38:02 +08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
|
2022-03-14 20:57:01 +08:00
|
|
|
// https://github.com/ant-design/ant-design/issues/31333
|
2022-08-08 15:50:49 +08:00
|
|
|
[`${antCls}-cascader-picker`]: {
|
2022-03-14 20:57:01 +08:00
|
|
|
margin: `-9px -${token.inputPaddingHorizontal}px`,
|
|
|
|
backgroundColor: 'transparent',
|
2022-08-08 15:50:49 +08:00
|
|
|
[`${antCls}-cascader-input`]: {
|
2022-03-14 20:57:01 +08:00
|
|
|
textAlign: 'start',
|
|
|
|
border: 0,
|
|
|
|
boxShadow: 'none',
|
2022-03-09 10:38:02 +08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
2022-03-14 20:57:01 +08:00
|
|
|
'&-addon:first-child': {
|
|
|
|
borderInlineEnd: 0,
|
2022-03-09 10:38:02 +08:00
|
|
|
},
|
|
|
|
|
2022-03-14 20:57:01 +08:00
|
|
|
'&-addon:last-child': {
|
|
|
|
borderInlineStart: 0,
|
|
|
|
},
|
2022-03-09 10:38:02 +08:00
|
|
|
},
|
|
|
|
|
2022-03-14 20:57:01 +08:00
|
|
|
[`.${prefixCls}`]: {
|
|
|
|
float: 'inline-start',
|
|
|
|
width: '100%',
|
|
|
|
marginBottom: 0,
|
|
|
|
textAlign: 'inherit',
|
2022-03-09 10:38:02 +08:00
|
|
|
|
2022-03-14 20:57:01 +08:00
|
|
|
'&:focus': {
|
|
|
|
zIndex: 1, // Fix https://gw.alipayobjects.com/zos/rmsportal/DHNpoqfMXSfrSnlZvhsJ.png
|
|
|
|
borderInlineEndWidth: 1,
|
|
|
|
},
|
2022-03-09 10:38:02 +08:00
|
|
|
|
2022-03-14 20:57:01 +08:00
|
|
|
'&:hover': {
|
|
|
|
zIndex: 1,
|
|
|
|
borderInlineEndWidth: 1,
|
2022-03-09 10:38:02 +08:00
|
|
|
|
2022-03-14 20:57:01 +08:00
|
|
|
[`.${prefixCls}-search-with-button &`]: {
|
|
|
|
zIndex: 0,
|
|
|
|
},
|
2022-03-09 10:38:02 +08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
|
2022-03-14 20:57:01 +08:00
|
|
|
// Reset rounded corners
|
|
|
|
[`> .${prefixCls}:first-child, .${prefixCls}-group-addon:first-child`]: {
|
2022-03-09 10:38:02 +08:00
|
|
|
borderStartEndRadius: 0,
|
|
|
|
borderEndEndRadius: 0,
|
|
|
|
|
2022-03-14 20:57:01 +08:00
|
|
|
// Reset Select's style in addon
|
2022-08-08 15:50:49 +08:00
|
|
|
[`${antCls}-select ${antCls}-select-selector`]: {
|
2022-03-14 20:57:01 +08:00
|
|
|
borderStartEndRadius: 0,
|
|
|
|
borderEndEndRadius: 0,
|
|
|
|
},
|
2022-03-09 10:38:02 +08:00
|
|
|
},
|
|
|
|
|
2022-03-14 20:57:01 +08:00
|
|
|
[`> .${prefixCls}-affix-wrapper`]: {
|
|
|
|
[`&:not(:first-child) .${prefixCls}`]: {
|
|
|
|
borderStartStartRadius: 0,
|
|
|
|
borderEndStartRadius: 0,
|
|
|
|
},
|
2022-03-09 10:38:02 +08:00
|
|
|
|
2022-03-14 20:57:01 +08:00
|
|
|
[`&:not(:last-child) .${prefixCls}`]: {
|
|
|
|
borderStartEndRadius: 0,
|
|
|
|
borderEndEndRadius: 0,
|
|
|
|
},
|
|
|
|
},
|
2022-03-09 10:38:02 +08:00
|
|
|
|
2022-03-14 20:57:01 +08:00
|
|
|
[`> .${prefixCls}:last-child, .${prefixCls}-group-addon:last-child`]: {
|
2022-03-09 10:38:02 +08:00
|
|
|
borderStartStartRadius: 0,
|
|
|
|
borderEndStartRadius: 0,
|
|
|
|
|
2022-03-14 20:57:01 +08:00
|
|
|
// Reset Select's style in addon
|
2022-08-08 15:50:49 +08:00
|
|
|
[`${antCls}-select ${antCls}-select-selector`]: {
|
2022-03-14 20:57:01 +08:00
|
|
|
borderStartStartRadius: 0,
|
|
|
|
borderEndStartRadius: 0,
|
2022-03-09 10:38:02 +08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
|
2022-03-14 20:57:01 +08:00
|
|
|
[`.${prefixCls}-affix-wrapper`]: {
|
|
|
|
'&:not(:last-child)': {
|
|
|
|
borderStartEndRadius: 0,
|
|
|
|
borderEndEndRadius: 0,
|
|
|
|
[`.${prefixCls}-search &`]: {
|
2022-11-01 15:06:38 +08:00
|
|
|
borderStartStartRadius: token.borderRadius,
|
|
|
|
borderEndStartRadius: token.borderRadius,
|
2022-03-14 20:57:01 +08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
[`&:not(:first-child), .${prefixCls}-search &:not(:first-child)`]: {
|
|
|
|
borderStartStartRadius: 0,
|
|
|
|
borderEndStartRadius: 0,
|
|
|
|
},
|
2022-03-09 10:38:02 +08:00
|
|
|
},
|
|
|
|
|
2022-03-14 20:57:01 +08:00
|
|
|
'&&-compact': {
|
|
|
|
display: 'block',
|
|
|
|
...clearFix(),
|
2022-03-09 10:38:02 +08:00
|
|
|
|
2022-03-14 20:57:01 +08:00
|
|
|
[`.${prefixCls}-group-addon, .${prefixCls}-group-wrap, > .${prefixCls}`]: {
|
|
|
|
'&:not(:first-child):not(:last-child)': {
|
2022-11-01 15:06:38 +08:00
|
|
|
borderInlineEndWidth: token.lineWidth,
|
2022-03-09 10:38:02 +08:00
|
|
|
|
2022-03-14 20:57:01 +08:00
|
|
|
'&:hover': {
|
|
|
|
zIndex: 1,
|
|
|
|
},
|
2022-03-09 10:38:02 +08:00
|
|
|
|
2022-03-14 20:57:01 +08:00
|
|
|
'&:focus': {
|
|
|
|
zIndex: 1,
|
|
|
|
},
|
2022-03-09 10:38:02 +08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
|
2022-03-14 20:57:01 +08:00
|
|
|
'& > *': {
|
|
|
|
display: 'inline-block',
|
|
|
|
float: 'none',
|
|
|
|
verticalAlign: 'top', // https://github.com/ant-design/ant-design-pro/issues/139
|
|
|
|
borderRadius: 0,
|
|
|
|
},
|
2022-03-09 10:38:02 +08:00
|
|
|
|
2022-03-14 20:57:01 +08:00
|
|
|
[`& > .${prefixCls}-affix-wrapper`]: {
|
|
|
|
display: 'inline-flex',
|
|
|
|
},
|
2022-03-09 10:38:02 +08:00
|
|
|
|
2022-08-08 15:50:49 +08:00
|
|
|
[`& > ${antCls}-picker-range`]: {
|
2022-03-14 20:57:01 +08:00
|
|
|
display: 'inline-flex',
|
|
|
|
},
|
2022-03-09 10:38:02 +08:00
|
|
|
|
2022-03-14 20:57:01 +08:00
|
|
|
'& > *:not(:last-child)': {
|
2022-11-01 15:06:38 +08:00
|
|
|
marginInlineEnd: -token.lineWidth,
|
|
|
|
borderInlineEndWidth: token.lineWidth,
|
2022-03-14 20:57:01 +08:00
|
|
|
},
|
2022-03-09 10:38:02 +08:00
|
|
|
|
2022-03-14 20:57:01 +08:00
|
|
|
// Undo float for .ant-input-group .ant-input
|
|
|
|
[`.${prefixCls}`]: {
|
|
|
|
float: 'none',
|
|
|
|
},
|
2022-03-09 10:38:02 +08:00
|
|
|
|
2022-03-14 20:57:01 +08:00
|
|
|
// reset border for Select, DatePicker, AutoComplete, Cascader, Mention, TimePicker, Input
|
2022-08-08 15:50:49 +08:00
|
|
|
[`& > ${antCls}-select > ${antCls}-select-selector,
|
|
|
|
& > ${antCls}-select-auto-complete .${prefixCls},
|
|
|
|
& > ${antCls}-cascader-picker .${prefixCls},
|
2022-03-09 10:38:02 +08:00
|
|
|
& > .${prefixCls}-group-wrapper .${prefixCls}`]: {
|
2022-11-01 15:06:38 +08:00
|
|
|
borderInlineEndWidth: token.lineWidth,
|
2022-03-14 20:57:01 +08:00
|
|
|
borderRadius: 0,
|
2022-03-09 10:38:02 +08:00
|
|
|
|
2022-03-14 20:57:01 +08:00
|
|
|
'&:hover': {
|
|
|
|
zIndex: 1,
|
|
|
|
},
|
|
|
|
|
|
|
|
'&:focus': {
|
|
|
|
zIndex: 1,
|
|
|
|
},
|
2022-03-09 10:38:02 +08:00
|
|
|
},
|
|
|
|
|
2022-08-08 15:50:49 +08:00
|
|
|
[`& > ${antCls}-select-focused`]: {
|
2022-03-09 10:38:02 +08:00
|
|
|
zIndex: 1,
|
|
|
|
},
|
|
|
|
|
2022-03-14 20:57:01 +08:00
|
|
|
// update z-index for arrow icon
|
2022-08-08 15:50:49 +08:00
|
|
|
[`& > ${antCls}-select > ${antCls}-select-arrow`]: {
|
2022-03-14 20:57:01 +08:00
|
|
|
zIndex: 1, // https://github.com/ant-design/ant-design/issues/20371
|
|
|
|
},
|
2022-03-09 10:38:02 +08:00
|
|
|
|
2022-03-14 20:57:01 +08:00
|
|
|
[`& > *:first-child,
|
2022-08-08 15:50:49 +08:00
|
|
|
& > ${antCls}-select:first-child > ${antCls}-select-selector,
|
|
|
|
& > ${antCls}-select-auto-complete:first-child .${prefixCls},
|
|
|
|
& > ${antCls}-cascader-picker:first-child .${prefixCls}`]: {
|
2022-11-01 15:06:38 +08:00
|
|
|
borderStartStartRadius: token.borderRadius,
|
|
|
|
borderEndStartRadius: token.borderRadius,
|
2022-03-14 20:57:01 +08:00
|
|
|
},
|
2022-03-09 10:38:02 +08:00
|
|
|
|
2022-03-14 20:57:01 +08:00
|
|
|
[`& > *:last-child,
|
2022-08-08 15:50:49 +08:00
|
|
|
& > ${antCls}-select:last-child > ${antCls}-select-selector,
|
|
|
|
& > ${antCls}-cascader-picker:last-child .${prefixCls},
|
|
|
|
& > ${antCls}-cascader-picker-focused:last-child .${prefixCls}`]: {
|
2022-11-01 15:06:38 +08:00
|
|
|
borderInlineEndWidth: token.lineWidth,
|
|
|
|
borderStartEndRadius: token.borderRadius,
|
|
|
|
borderEndEndRadius: token.borderRadius,
|
2022-03-14 20:57:01 +08:00
|
|
|
},
|
2022-03-09 10:38:02 +08:00
|
|
|
|
2022-03-14 20:57:01 +08:00
|
|
|
// https://github.com/ant-design/ant-design/issues/12493
|
2022-08-08 15:50:49 +08:00
|
|
|
[`& > ${antCls}-select-auto-complete .${prefixCls}`]: {
|
2022-03-14 20:57:01 +08:00
|
|
|
verticalAlign: 'top',
|
2022-03-09 10:38:02 +08:00
|
|
|
},
|
|
|
|
|
2022-03-14 20:57:01 +08:00
|
|
|
[`.${prefixCls}-group-wrapper + .${prefixCls}-group-wrapper`]: {
|
2022-11-01 15:06:38 +08:00
|
|
|
marginInlineStart: -token.lineWidth,
|
2022-03-14 20:57:01 +08:00
|
|
|
[`.${prefixCls}-affix-wrapper`]: {
|
2022-03-09 10:38:02 +08:00
|
|
|
borderRadius: 0,
|
|
|
|
},
|
2022-03-14 20:57:01 +08:00
|
|
|
},
|
2022-03-09 10:38:02 +08:00
|
|
|
|
2022-03-14 20:57:01 +08:00
|
|
|
[`.${prefixCls}-group-wrapper:not(:last-child)`]: {
|
|
|
|
[`&.${prefixCls}-search > .${prefixCls}-group`]: {
|
|
|
|
[`& > .${prefixCls}-group-addon > .${prefixCls}-search-button`]: {
|
|
|
|
borderRadius: 0,
|
|
|
|
},
|
|
|
|
|
|
|
|
[`& > .${prefixCls}`]: {
|
2022-11-01 15:06:38 +08:00
|
|
|
borderStartStartRadius: token.borderRadius,
|
2022-03-14 20:57:01 +08:00
|
|
|
borderStartEndRadius: 0,
|
|
|
|
borderEndEndRadius: 0,
|
2022-11-01 15:06:38 +08:00
|
|
|
borderEndStartRadius: token.borderRadius,
|
2022-03-14 20:57:01 +08:00
|
|
|
},
|
2022-03-09 10:38:02 +08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2022-03-14 20:57:01 +08:00
|
|
|
};
|
|
|
|
};
|
2022-03-09 10:38:02 +08:00
|
|
|
|
2022-03-14 20:57:01 +08:00
|
|
|
const genInputStyle: GenerateStyle<InputToken> = (token: InputToken) => {
|
2022-11-01 15:06:38 +08:00
|
|
|
const { prefixCls, controlHeightSM, lineWidth } = token;
|
2022-03-29 15:57:39 +08:00
|
|
|
|
|
|
|
const FIXED_CHROME_COLOR_HEIGHT = 16;
|
2022-11-01 15:06:38 +08:00
|
|
|
const colorSmallPadding = (controlHeightSM - lineWidth * 2 - FIXED_CHROME_COLOR_HEIGHT) / 2;
|
2022-03-09 10:38:02 +08:00
|
|
|
|
2022-03-14 20:57:01 +08:00
|
|
|
return {
|
|
|
|
[`.${prefixCls}`]: {
|
|
|
|
...resetComponent(token),
|
|
|
|
...genBasicInputStyle(token),
|
|
|
|
...genStatusStyle(token),
|
2022-10-28 16:09:38 +08:00
|
|
|
...genCompactItemStyle(token, prefixCls),
|
2022-03-09 10:38:02 +08:00
|
|
|
|
2022-03-14 20:57:01 +08:00
|
|
|
'&[type="color"]': {
|
|
|
|
height: token.controlHeight,
|
2022-03-09 10:38:02 +08:00
|
|
|
|
2022-03-14 20:57:01 +08:00
|
|
|
[`&.${prefixCls}-lg`]: {
|
|
|
|
height: token.controlHeightLG,
|
|
|
|
},
|
|
|
|
[`&.${prefixCls}-sm`]: {
|
2022-03-29 15:57:39 +08:00
|
|
|
height: controlHeightSM,
|
|
|
|
paddingTop: colorSmallPadding,
|
|
|
|
paddingBottom: colorSmallPadding,
|
2022-03-14 20:57:01 +08:00
|
|
|
},
|
|
|
|
},
|
2022-03-09 10:38:02 +08:00
|
|
|
},
|
2022-03-14 20:57:01 +08:00
|
|
|
};
|
|
|
|
};
|
2022-03-09 10:38:02 +08:00
|
|
|
|
2022-03-14 20:57:01 +08:00
|
|
|
const genAllowClearStyle = (token: InputToken): CSSObject => {
|
|
|
|
const { prefixCls } = token;
|
|
|
|
return {
|
|
|
|
// ========================= Input =========================
|
2022-03-09 10:38:02 +08:00
|
|
|
[`.${prefixCls}-clear-icon`]: {
|
2022-03-14 20:57:01 +08:00
|
|
|
margin: 0,
|
2022-07-21 17:00:42 +08:00
|
|
|
color: token.colorIcon,
|
2022-03-29 15:57:39 +08:00
|
|
|
fontSize: token.fontSizeIcon,
|
|
|
|
verticalAlign: -1,
|
2022-03-14 20:57:01 +08:00
|
|
|
// https://github.com/ant-design/ant-design/pull/18151
|
|
|
|
// https://codesandbox.io/s/wizardly-sun-u10br
|
|
|
|
cursor: 'pointer',
|
2022-03-22 20:02:04 +08:00
|
|
|
transition: `color ${token.motionDurationSlow}`,
|
2022-03-09 10:38:02 +08:00
|
|
|
|
2022-03-14 20:57:01 +08:00
|
|
|
'&:hover': {
|
2022-08-04 16:16:50 +08:00
|
|
|
color: token.colorTextDescription,
|
2022-03-14 20:57:01 +08:00
|
|
|
},
|
2022-03-09 10:38:02 +08:00
|
|
|
|
2022-03-14 20:57:01 +08:00
|
|
|
'&:active': {
|
2022-03-22 09:37:37 +08:00
|
|
|
color: token.colorText,
|
2022-03-14 20:57:01 +08:00
|
|
|
},
|
2022-03-09 10:38:02 +08:00
|
|
|
|
2022-03-14 20:57:01 +08:00
|
|
|
'&-hidden': {
|
|
|
|
visibility: 'hidden',
|
|
|
|
},
|
2022-03-09 10:38:02 +08:00
|
|
|
|
2022-03-14 20:57:01 +08:00
|
|
|
'&-has-suffix': {
|
2022-03-29 15:57:39 +08:00
|
|
|
margin: `0 ${token.inputAffixPadding}px`,
|
2022-03-14 20:57:01 +08:00
|
|
|
},
|
2022-03-09 10:38:02 +08:00
|
|
|
},
|
|
|
|
|
2022-03-14 20:57:01 +08:00
|
|
|
// ======================= TextArea ========================
|
|
|
|
'&-textarea-with-clear-btn': {
|
|
|
|
padding: '0 !important',
|
|
|
|
border: '0 !important',
|
2022-03-09 10:38:02 +08:00
|
|
|
|
2022-03-14 20:57:01 +08:00
|
|
|
[`.${prefixCls}-clear-icon`]: {
|
|
|
|
position: 'absolute',
|
|
|
|
insetBlockStart: token.paddingXS,
|
|
|
|
insetInlineEnd: token.paddingXS,
|
|
|
|
zIndex: 1,
|
|
|
|
},
|
2022-03-09 10:38:02 +08:00
|
|
|
},
|
2022-03-14 20:57:01 +08:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
const genAffixStyle: GenerateStyle<InputToken> = (token: InputToken) => {
|
|
|
|
const {
|
|
|
|
prefixCls,
|
2022-03-29 15:57:39 +08:00
|
|
|
inputAffixPadding,
|
2022-08-04 16:16:50 +08:00
|
|
|
colorTextDescription,
|
2022-03-24 14:30:48 +08:00
|
|
|
motionDurationSlow,
|
2022-07-21 17:00:42 +08:00
|
|
|
colorIcon,
|
|
|
|
colorIconHover,
|
2022-04-06 21:49:30 +08:00
|
|
|
iconCls,
|
2022-03-14 20:57:01 +08:00
|
|
|
} = token;
|
|
|
|
|
|
|
|
return {
|
|
|
|
[`.${prefixCls}-affix-wrapper`]: {
|
|
|
|
...genBasicInputStyle(token),
|
|
|
|
display: 'inline-flex',
|
2022-03-09 10:38:02 +08:00
|
|
|
|
2022-03-14 20:57:01 +08:00
|
|
|
'&:not(&-disabled):hover': {
|
|
|
|
...genHoverStyle(token),
|
|
|
|
zIndex: 1,
|
|
|
|
[`.${prefixCls}-search-with-button &`]: {
|
|
|
|
zIndex: 0,
|
|
|
|
},
|
|
|
|
},
|
2022-03-09 10:38:02 +08:00
|
|
|
|
2022-03-14 20:57:01 +08:00
|
|
|
'&-focused, &:focus': {
|
|
|
|
zIndex: 1,
|
|
|
|
},
|
2022-03-09 10:38:02 +08:00
|
|
|
|
2022-03-14 20:57:01 +08:00
|
|
|
'&-disabled': {
|
|
|
|
[`.${prefixCls}[disabled]`]: {
|
|
|
|
background: 'transparent',
|
|
|
|
},
|
|
|
|
},
|
2022-03-09 10:38:02 +08:00
|
|
|
|
2022-03-14 20:57:01 +08:00
|
|
|
[`> input.${prefixCls}`]: {
|
|
|
|
padding: 0,
|
2022-10-11 20:29:55 +08:00
|
|
|
fontSize: 'inherit',
|
2022-03-14 20:57:01 +08:00
|
|
|
border: 'none',
|
|
|
|
outline: 'none',
|
2022-03-09 10:38:02 +08:00
|
|
|
|
2022-03-14 20:57:01 +08:00
|
|
|
'&:focus': {
|
|
|
|
boxShadow: 'none !important',
|
|
|
|
},
|
|
|
|
},
|
2022-03-09 10:38:02 +08:00
|
|
|
|
2022-03-14 20:57:01 +08:00
|
|
|
'&::before': {
|
|
|
|
width: 0,
|
|
|
|
visibility: 'hidden',
|
|
|
|
content: '"\\a0"',
|
|
|
|
},
|
2022-03-09 10:38:02 +08:00
|
|
|
|
2022-03-14 20:57:01 +08:00
|
|
|
[`.${prefixCls}`]: {
|
|
|
|
'&-prefix, &-suffix': {
|
|
|
|
display: 'flex',
|
|
|
|
flex: 'none',
|
|
|
|
alignItems: 'center',
|
2022-03-25 20:08:05 +08:00
|
|
|
|
|
|
|
'> *:not(:last-child)': {
|
2022-03-29 15:57:39 +08:00
|
|
|
marginInlineEnd: token.paddingXS,
|
2022-03-25 20:08:05 +08:00
|
|
|
},
|
2022-03-14 20:57:01 +08:00
|
|
|
},
|
2022-03-09 10:38:02 +08:00
|
|
|
|
2022-03-14 20:57:01 +08:00
|
|
|
'&-show-count-suffix': {
|
2022-08-04 16:16:50 +08:00
|
|
|
color: colorTextDescription,
|
2022-03-14 20:57:01 +08:00
|
|
|
},
|
2022-03-09 10:38:02 +08:00
|
|
|
|
2022-03-14 20:57:01 +08:00
|
|
|
'&-show-count-has-suffix': {
|
2022-03-29 15:57:39 +08:00
|
|
|
marginInlineEnd: token.paddingXXS,
|
2022-03-14 20:57:01 +08:00
|
|
|
},
|
2022-03-09 10:38:02 +08:00
|
|
|
|
2022-03-14 20:57:01 +08:00
|
|
|
'&-prefix': {
|
2022-03-29 15:57:39 +08:00
|
|
|
marginInlineEnd: inputAffixPadding,
|
2022-03-14 20:57:01 +08:00
|
|
|
},
|
2022-03-09 10:38:02 +08:00
|
|
|
|
2022-03-14 20:57:01 +08:00
|
|
|
'&-suffix': {
|
2022-03-29 15:57:39 +08:00
|
|
|
marginInlineStart: inputAffixPadding,
|
2022-03-14 20:57:01 +08:00
|
|
|
},
|
|
|
|
},
|
2022-03-09 10:38:02 +08:00
|
|
|
|
2022-03-14 20:57:01 +08:00
|
|
|
...genAllowClearStyle(token),
|
2022-03-09 10:38:02 +08:00
|
|
|
|
2022-03-14 20:57:01 +08:00
|
|
|
// password
|
2022-04-06 21:49:30 +08:00
|
|
|
[`${iconCls}.${prefixCls}-password-icon`]: {
|
2022-07-21 17:00:42 +08:00
|
|
|
color: colorIcon,
|
2022-03-14 20:57:01 +08:00
|
|
|
cursor: 'pointer',
|
2022-03-24 14:30:48 +08:00
|
|
|
transition: `all ${motionDurationSlow}`,
|
2022-03-09 10:38:02 +08:00
|
|
|
|
2022-03-14 20:57:01 +08:00
|
|
|
'&:hover': {
|
2022-07-21 17:00:42 +08:00
|
|
|
color: colorIconHover,
|
2022-03-14 20:57:01 +08:00
|
|
|
},
|
|
|
|
},
|
2022-03-09 10:38:02 +08:00
|
|
|
|
2022-03-14 20:57:01 +08:00
|
|
|
// status
|
|
|
|
...genStatusStyle(token),
|
2022-03-09 10:38:02 +08:00
|
|
|
},
|
2022-03-14 20:57:01 +08:00
|
|
|
};
|
|
|
|
};
|
2022-03-09 10:38:02 +08:00
|
|
|
|
2022-03-14 20:57:01 +08:00
|
|
|
const genGroupStyle: GenerateStyle<InputToken> = (token: InputToken) => {
|
2022-11-01 15:06:38 +08:00
|
|
|
const { prefixCls, colorError, colorSuccess, componentCls, borderRadiusLG, borderRadiusSM } =
|
2022-08-19 10:10:51 +08:00
|
|
|
token;
|
2022-03-09 10:38:02 +08:00
|
|
|
|
2022-03-14 20:57:01 +08:00
|
|
|
return {
|
|
|
|
[`.${prefixCls}-group`]: {
|
|
|
|
// Style for input-group: input with label, with button or dropdown...
|
|
|
|
...resetComponent(token),
|
|
|
|
...genInputGroupStyle(token),
|
|
|
|
|
|
|
|
'&-rtl': {
|
|
|
|
direction: 'rtl',
|
2022-03-09 10:38:02 +08:00
|
|
|
},
|
|
|
|
|
2022-03-14 20:57:01 +08:00
|
|
|
'&-wrapper': {
|
|
|
|
display: 'inline-block',
|
|
|
|
width: '100%',
|
|
|
|
textAlign: 'start',
|
|
|
|
verticalAlign: 'top', // https://github.com/ant-design/ant-design/issues/6403
|
2022-03-09 10:38:02 +08:00
|
|
|
|
2022-03-14 20:57:01 +08:00
|
|
|
'&-rtl': {
|
|
|
|
direction: 'rtl',
|
|
|
|
},
|
2022-08-19 10:10:51 +08:00
|
|
|
|
|
|
|
// Size
|
|
|
|
'&-lg': {
|
|
|
|
[`${componentCls}-group-addon`]: {
|
2022-11-01 15:06:38 +08:00
|
|
|
borderRadius: borderRadiusLG,
|
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
|
|
|
},
|
|
|
|
},
|
2022-03-09 10:38:02 +08:00
|
|
|
|
2022-03-14 20:57:01 +08:00
|
|
|
// Status
|
|
|
|
'&-status-error': {
|
|
|
|
[`.${prefixCls}-group-addon`]: {
|
2022-03-22 09:37:37 +08:00
|
|
|
color: colorError,
|
|
|
|
borderColor: colorError,
|
2022-03-14 20:57:01 +08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
'&-status-warning': {
|
2022-10-11 20:29:55 +08:00
|
|
|
[`.${prefixCls}-group-addon:last-child`]: {
|
2022-03-22 09:37:37 +08:00
|
|
|
color: colorSuccess,
|
|
|
|
borderColor: colorSuccess,
|
2022-03-14 20:57:01 +08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
const genSearchInputStyle: GenerateStyle<InputToken> = (token: InputToken) => {
|
2022-08-08 15:50:49 +08:00
|
|
|
const { prefixCls, antCls } = token;
|
2022-03-14 20:57:01 +08:00
|
|
|
const searchPrefixCls = `.${prefixCls}-search`;
|
|
|
|
return {
|
|
|
|
[searchPrefixCls]: {
|
|
|
|
[`.${prefixCls}`]: {
|
|
|
|
'&:hover, &:focus': {
|
2022-03-22 20:02:04 +08:00
|
|
|
borderColor: token.colorPrimaryHover,
|
2022-03-14 20:57:01 +08:00
|
|
|
|
|
|
|
[`+ .${prefixCls}-group-addon ${searchPrefixCls}-button:not(.@{ant-prefix}-btn-primary)`]:
|
|
|
|
{
|
2022-03-22 20:02:04 +08:00
|
|
|
borderInlineStartColor: token.colorPrimaryHover,
|
2022-03-14 20:57:01 +08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2022-03-09 10:38:02 +08:00
|
|
|
|
2022-03-14 20:57:01 +08:00
|
|
|
[`.${prefixCls}-affix-wrapper`]: {
|
|
|
|
borderRadius: 0,
|
2022-03-09 10:38:02 +08:00
|
|
|
},
|
|
|
|
|
2022-03-14 20:57:01 +08:00
|
|
|
// fix slight height diff in Firefox:
|
|
|
|
// https://ant.design/components/auto-complete-cn/#components-auto-complete-demo-certain-category
|
|
|
|
[`.${prefixCls}-lg`]: {
|
|
|
|
lineHeight: token.lineHeight - 0.0002,
|
|
|
|
},
|
|
|
|
|
|
|
|
[`> .${prefixCls}-group`]: {
|
|
|
|
[`> .${prefixCls}-group-addon:last-child`]: {
|
|
|
|
insetInlineStart: -1,
|
|
|
|
padding: 0,
|
|
|
|
border: 0,
|
2022-03-09 10:38:02 +08:00
|
|
|
|
2022-03-14 20:57:01 +08:00
|
|
|
[`${searchPrefixCls}-button`]: {
|
|
|
|
paddingTop: 0,
|
|
|
|
paddingBottom: 0,
|
|
|
|
borderStartStartRadius: 0,
|
2022-11-01 15:06:38 +08:00
|
|
|
borderStartEndRadius: token.borderRadius,
|
|
|
|
borderEndEndRadius: token.borderRadius,
|
2022-03-14 20:57:01 +08:00
|
|
|
borderEndStartRadius: 0,
|
|
|
|
},
|
|
|
|
|
2022-08-08 15:50:49 +08:00
|
|
|
[`${searchPrefixCls}-button:not(${antCls}-btn-primary)`]: {
|
2022-08-04 16:16:50 +08:00
|
|
|
color: token.colorTextDescription,
|
2022-03-14 20:57:01 +08:00
|
|
|
|
2022-09-20 21:50:36 +08:00
|
|
|
'&:hover': {
|
|
|
|
color: token.colorPrimaryHover,
|
|
|
|
},
|
|
|
|
|
|
|
|
'&:active': {
|
|
|
|
color: token.colorPrimaryActive,
|
|
|
|
},
|
|
|
|
|
2022-08-08 15:50:49 +08:00
|
|
|
[`&${antCls}-btn-loading::before`]: {
|
2022-03-14 20:57:01 +08:00
|
|
|
insetInlineStart: 0,
|
|
|
|
insetInlineEnd: 0,
|
|
|
|
insetBlockStart: 0,
|
|
|
|
insetBlockEnd: 0,
|
|
|
|
},
|
|
|
|
},
|
2022-03-09 10:38:02 +08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
|
2022-03-14 20:57:01 +08:00
|
|
|
[`${searchPrefixCls}-button`]: {
|
|
|
|
height: token.controlHeight,
|
2022-03-09 10:38:02 +08:00
|
|
|
|
2022-03-14 20:57:01 +08:00
|
|
|
'&:hover, &:focus': {
|
|
|
|
zIndex: 1,
|
|
|
|
},
|
|
|
|
},
|
2022-03-09 10:38:02 +08:00
|
|
|
|
2022-03-14 20:57:01 +08:00
|
|
|
[`&-large ${searchPrefixCls}-button`]: {
|
|
|
|
height: token.controlHeightLG,
|
|
|
|
},
|
2022-03-09 10:38:02 +08:00
|
|
|
|
2022-03-14 20:57:01 +08:00
|
|
|
[`&-small ${searchPrefixCls}-button`]: {
|
|
|
|
height: token.controlHeightSM,
|
|
|
|
},
|
2022-03-09 10:38:02 +08:00
|
|
|
|
2022-03-14 20:57:01 +08:00
|
|
|
'&-rtl': {
|
|
|
|
direction: 'rtl',
|
|
|
|
},
|
2022-10-28 16:09:38 +08:00
|
|
|
|
|
|
|
// ===================== Compact Item Customized Styles =====================
|
|
|
|
[`&.${prefixCls}-compact-item`]: {
|
|
|
|
[`&:not(.${prefixCls}-compact-last-item)`]: {
|
|
|
|
[`.${prefixCls}-group-addon`]: {
|
|
|
|
[`.${prefixCls}-search-button`]: {
|
2022-11-01 15:06:38 +08:00
|
|
|
marginInlineEnd: -token.lineWidth,
|
2022-10-28 16:09:38 +08:00
|
|
|
borderRadius: 0,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
[`&:not(.${prefixCls}-compact-first-item)`]: {
|
|
|
|
[`.${prefixCls},.${prefixCls}-affix-wrapper`]: {
|
|
|
|
borderRadius: 0,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
[`> .${prefixCls}-group-addon .${prefixCls}-search-button,
|
|
|
|
> .${prefixCls},
|
|
|
|
.${prefixCls}-affix-wrapper`]: {
|
|
|
|
'&:hover,&:focus,&:active': {
|
|
|
|
zIndex: 2,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
[`> .${prefixCls}-affix-wrapper-focused`]: {
|
|
|
|
zIndex: 2,
|
|
|
|
},
|
|
|
|
},
|
2022-03-14 20:57:01 +08:00
|
|
|
},
|
|
|
|
};
|
|
|
|
};
|
2022-03-09 10:38:02 +08:00
|
|
|
|
2022-04-06 21:49:30 +08:00
|
|
|
export function initInputToken<T extends GlobalToken = GlobalToken>(token: T): InputToken<T> {
|
2022-04-11 16:04:00 +08:00
|
|
|
// @ts-ignore
|
|
|
|
return mergeToken<InputToken<T>>(token, {
|
2022-04-06 21:49:30 +08:00
|
|
|
inputAffixPadding: token.paddingXXS,
|
|
|
|
inputPaddingVertical: Math.max(
|
|
|
|
Math.round(((token.controlHeight - token.fontSize * token.lineHeight) / 2) * 10) / 10 -
|
2022-11-01 15:06:38 +08:00
|
|
|
token.lineWidth,
|
2022-04-06 21:49:30 +08:00
|
|
|
3,
|
|
|
|
),
|
|
|
|
inputPaddingVerticalLG:
|
|
|
|
Math.ceil(((token.controlHeightLG - token.fontSizeLG * token.lineHeight) / 2) * 10) / 10 -
|
2022-11-01 15:06:38 +08:00
|
|
|
token.lineWidth,
|
2022-04-06 21:49:30 +08:00
|
|
|
inputPaddingVerticalSM: Math.max(
|
|
|
|
Math.round(((token.controlHeightSM - token.fontSize * token.lineHeight) / 2) * 10) / 10 -
|
2022-11-01 15:06:38 +08:00
|
|
|
token.lineWidth,
|
2022-04-06 21:49:30 +08:00
|
|
|
0,
|
|
|
|
),
|
2022-11-01 15:06:38 +08:00
|
|
|
inputPaddingHorizontal: token.controlPaddingHorizontal - token.lineWidth,
|
|
|
|
inputPaddingHorizontalSM: token.controlPaddingHorizontalSM - token.lineWidth,
|
2022-04-06 21:49:30 +08:00
|
|
|
inputBorderHoverColor: token.colorPrimaryHover,
|
|
|
|
inputBorderActiveColor: token.colorPrimaryHover,
|
2022-04-11 16:04:00 +08:00
|
|
|
});
|
2022-04-06 21:49:30 +08:00
|
|
|
}
|
2022-03-14 11:40:13 +08:00
|
|
|
|
2022-03-14 20:57:01 +08:00
|
|
|
const genTextAreaStyle: GenerateStyle<InputToken> = token => {
|
|
|
|
const { prefixCls, inputPaddingHorizontal, paddingLG } = token;
|
|
|
|
const textareaPrefixCls = `.${prefixCls}-textarea`;
|
|
|
|
|
|
|
|
return {
|
|
|
|
[textareaPrefixCls]: {
|
2022-03-29 15:57:39 +08:00
|
|
|
position: 'relative',
|
|
|
|
|
2022-03-25 20:08:05 +08:00
|
|
|
[`${textareaPrefixCls}-suffix`]: {
|
2022-03-14 20:57:01 +08:00
|
|
|
position: 'absolute',
|
|
|
|
top: 0,
|
|
|
|
insetInlineEnd: inputPaddingHorizontal,
|
|
|
|
bottom: 0,
|
|
|
|
zIndex: 1,
|
|
|
|
display: 'inline-flex',
|
|
|
|
alignItems: 'center',
|
|
|
|
margin: 'auto',
|
|
|
|
},
|
|
|
|
|
|
|
|
[`&-status-error,
|
|
|
|
&-status-warning,
|
|
|
|
&-status-success,
|
|
|
|
&-status-validating`]: {
|
|
|
|
[`&${textareaPrefixCls}-has-feedback`]: {
|
|
|
|
[`.${prefixCls}`]: {
|
|
|
|
paddingInlineEnd: paddingLG,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2022-03-25 20:08:05 +08:00
|
|
|
|
|
|
|
'&-show-count': {
|
|
|
|
// https://github.com/ant-design/ant-design/issues/33049
|
|
|
|
[`> .${prefixCls}`]: {
|
|
|
|
height: '100%',
|
|
|
|
},
|
|
|
|
|
|
|
|
'&::after': {
|
2022-03-29 15:57:39 +08:00
|
|
|
position: 'absolute',
|
|
|
|
bottom: 0,
|
|
|
|
insetInlineEnd: 0,
|
2022-08-04 16:16:50 +08:00
|
|
|
color: token.colorTextDescription,
|
2022-03-25 20:08:05 +08:00
|
|
|
whiteSpace: 'nowrap',
|
|
|
|
content: 'attr(data-count)',
|
|
|
|
pointerEvents: 'none',
|
|
|
|
display: 'block',
|
2022-03-29 15:57:39 +08:00
|
|
|
transform: 'translateY(100%)',
|
2022-03-25 20:08:05 +08:00
|
|
|
},
|
|
|
|
},
|
2022-03-14 20:57:01 +08:00
|
|
|
},
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2022-03-09 10:38:02 +08:00
|
|
|
// ============================== Export ==============================
|
2022-04-06 21:49:30 +08:00
|
|
|
export default genComponentStyleHook('Input', token => {
|
|
|
|
const inputToken = initInputToken<FullToken<'Input'>>(token);
|
2022-03-09 10:38:02 +08:00
|
|
|
|
|
|
|
return [
|
2022-04-06 21:49:30 +08:00
|
|
|
genInputStyle(inputToken),
|
|
|
|
genTextAreaStyle(inputToken),
|
|
|
|
genAffixStyle(inputToken),
|
|
|
|
genGroupStyle(inputToken),
|
|
|
|
genSearchInputStyle(inputToken),
|
2022-03-09 10:38:02 +08:00
|
|
|
];
|
2022-04-06 21:49:30 +08:00
|
|
|
});
|