2022-05-09 22:20:07 +08:00
|
|
|
import type { CSSObject } from '@ant-design/cssinjs';
|
2023-11-29 17:23:45 +08:00
|
|
|
import { unit } from '@ant-design/cssinjs';
|
2023-10-10 16:22:23 +08:00
|
|
|
|
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';
|
2023-12-18 17:53:31 +08:00
|
|
|
import type { GenerateStyle } from '../../theme/internal';
|
2023-11-29 17:23:45 +08:00
|
|
|
import { genStyleHooks, mergeToken } from '../../theme/internal';
|
2024-01-09 15:18:44 +08:00
|
|
|
import type { ComponentToken, InputToken } from './token';
|
|
|
|
import { initComponentToken, initInputToken } from './token';
|
2023-12-18 17:53:31 +08:00
|
|
|
import {
|
|
|
|
genBorderlessStyle,
|
|
|
|
genFilledGroupStyle,
|
|
|
|
genFilledStyle,
|
|
|
|
genOutlinedGroupStyle,
|
|
|
|
genOutlinedStyle,
|
|
|
|
} from './variants';
|
|
|
|
|
|
|
|
export type { ComponentToken };
|
|
|
|
export { initComponentToken, initInputToken };
|
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 genActiveStyle = (token: InputToken) => ({
|
2023-08-22 09:38:11 +08:00
|
|
|
borderColor: token.activeBorderColor,
|
2023-08-25 09:32:39 +08:00
|
|
|
boxShadow: token.activeShadow,
|
2022-03-09 10:38:02 +08:00
|
|
|
outline: 0,
|
2023-09-12 15:06:35 +08:00
|
|
|
backgroundColor: token.activeBg,
|
2022-03-09 10:38:02 +08:00
|
|
|
});
|
|
|
|
|
2022-03-14 20:57:01 +08:00
|
|
|
const genInputLargeStyle = (token: InputToken): CSSObject => {
|
2024-01-09 15:18:44 +08:00
|
|
|
const { paddingBlockLG, lineHeightLG, borderRadiusLG, paddingInlineLG } = token;
|
2022-03-09 10:38:02 +08:00
|
|
|
|
2022-03-14 20:57:01 +08:00
|
|
|
return {
|
2023-11-10 17:32:43 +08:00
|
|
|
padding: `${unit(paddingBlockLG)} ${unit(paddingInlineLG)}`,
|
2024-01-09 15:18:44 +08:00
|
|
|
fontSize: token.inputFontSizeLG,
|
2022-11-08 15:37:35 +08:00
|
|
|
lineHeight: lineHeightLG,
|
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 => ({
|
2023-11-10 17:32:43 +08:00
|
|
|
padding: `${unit(token.paddingBlockSM)} ${unit(token.paddingInlineSM)}`,
|
2024-01-09 15:18:44 +08:00
|
|
|
fontSize: token.inputFontSizeSM,
|
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 genBasicInputStyle = (token: InputToken): CSSObject => ({
|
2022-03-09 10:38:02 +08:00
|
|
|
position: 'relative',
|
|
|
|
display: 'inline-block',
|
|
|
|
width: '100%',
|
|
|
|
minWidth: 0,
|
2023-11-10 17:32:43 +08:00
|
|
|
padding: `${unit(token.paddingBlock)} ${unit(token.paddingInline)}`,
|
2022-03-22 09:37:37 +08:00
|
|
|
color: token.colorText,
|
2024-01-09 15:18:44 +08:00
|
|
|
fontSize: token.inputFontSize,
|
2022-03-09 10:38:02 +08:00
|
|
|
lineHeight: token.lineHeight,
|
2022-11-01 15:06:38 +08:00
|
|
|
borderRadius: token.borderRadius,
|
2022-11-17 23:31:41 +08:00
|
|
|
transition: `all ${token.motionDurationMid}`,
|
2022-06-17 18:47:47 +08:00
|
|
|
...genPlaceholderStyle(token.colorTextPlaceholder),
|
2022-03-09 10:38:02 +08:00
|
|
|
|
|
|
|
// Reset height for `textarea`s
|
|
|
|
'textarea&': {
|
2023-02-23 21:56:43 +08:00
|
|
|
maxWidth: '100%', // prevent textarea resize from coming out of its container
|
2022-03-09 10:38:02 +08:00
|
|
|
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-11-30 17:32:02 +08:00
|
|
|
resize: 'vertical',
|
2022-03-09 10:38:02 +08:00
|
|
|
},
|
|
|
|
|
|
|
|
// Size
|
|
|
|
'&-lg': {
|
2022-03-14 20:57:01 +08:00
|
|
|
...genInputLargeStyle(token),
|
2022-03-09 10:38:02 +08:00
|
|
|
},
|
|
|
|
'&-sm': {
|
|
|
|
...genInputSmallStyle(token),
|
|
|
|
},
|
|
|
|
|
2022-11-30 17:32:02 +08:00
|
|
|
// RTL
|
2024-05-22 19:30:07 +08:00
|
|
|
'&-rtl, &-textarea-rtl': {
|
2022-11-30 17:32:02 +08:00
|
|
|
direction: 'rtl',
|
|
|
|
},
|
2022-03-09 10:38:02 +08:00
|
|
|
});
|
|
|
|
|
2022-03-14 20:57:01 +08:00
|
|
|
export const genInputGroupStyle = (token: InputToken): CSSObject => {
|
2022-11-08 15:37:35 +08:00
|
|
|
const { componentCls, 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
|
2024-06-22 21:59:12 +08:00
|
|
|
"&[class*='col-']": {
|
2022-03-14 20:57:01 +08:00
|
|
|
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
|
2022-11-08 15:37:35 +08:00
|
|
|
[`&-lg ${componentCls}, &-lg > ${componentCls}-group-addon`]: {
|
2022-03-14 20:57:01 +08:00
|
|
|
...genInputLargeStyle(token),
|
|
|
|
},
|
2022-03-09 10:38:02 +08:00
|
|
|
|
2022-11-08 15:37:35 +08:00
|
|
|
[`&-sm ${componentCls}, &-sm > ${componentCls}-group-addon`]: {
|
2022-03-14 20:57:01 +08:00
|
|
|
...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-11-08 15:37:35 +08:00
|
|
|
[`> ${componentCls}`]: {
|
2022-03-09 10:38:02 +08:00
|
|
|
display: 'table-cell',
|
|
|
|
|
|
|
|
'&:not(:first-child):not(:last-child)': {
|
|
|
|
borderRadius: 0,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
2022-11-08 15:37:35 +08:00
|
|
|
[`${componentCls}-group`]: {
|
2024-06-22 21:59:12 +08:00
|
|
|
'&-addon, &-wrap': {
|
2022-03-14 20:57:01 +08:00
|
|
|
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',
|
2023-11-10 17:32:43 +08:00
|
|
|
padding: `0 ${unit(token.paddingInline)}`,
|
2022-03-22 09:37:37 +08:00
|
|
|
color: token.colorText,
|
2022-03-14 20:57:01 +08:00
|
|
|
fontWeight: 'normal',
|
2024-01-09 15:18:44 +08:00
|
|
|
fontSize: token.inputFontSize,
|
2022-03-14 20:57:01 +08:00
|
|
|
textAlign: 'center',
|
2022-11-01 15:06:38 +08:00
|
|
|
borderRadius: token.borderRadius,
|
2022-03-22 20:02:04 +08:00
|
|
|
transition: `all ${token.motionDurationSlow}`,
|
2022-12-28 18:12:16 +08:00
|
|
|
lineHeight: 1,
|
2022-03-14 20:57:01 +08:00
|
|
|
|
|
|
|
// Reset Select's style in addon
|
2022-08-08 15:50:49 +08:00
|
|
|
[`${antCls}-select`]: {
|
2023-11-10 17:32:43 +08:00
|
|
|
margin: `${unit(token.calc(token.paddingBlock).add(1).mul(-1).equal())} ${unit(
|
|
|
|
token.calc(token.paddingInline).mul(-1).equal(),
|
|
|
|
)}`,
|
2022-03-14 20:57:01 +08:00
|
|
|
|
2023-09-13 17:19:21 +08:00
|
|
|
[`&${antCls}-select-single:not(${antCls}-select-customize-input):not(${antCls}-pagination-size-changer)`]:
|
|
|
|
{
|
|
|
|
[`${antCls}-select-selector`]: {
|
|
|
|
backgroundColor: 'inherit',
|
2023-11-10 17:32:43 +08:00
|
|
|
border: `${unit(token.lineWidth)} ${token.lineType} transparent`,
|
2023-09-13 17:19:21 +08:00
|
|
|
boxShadow: 'none',
|
|
|
|
},
|
2022-03-14 20:57:01 +08:00
|
|
|
},
|
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`]: {
|
2023-11-10 17:32:43 +08:00
|
|
|
margin: `-9px ${unit(token.calc(token.paddingInline).mul(-1).equal())}`,
|
2022-03-14 20:57:01 +08:00
|
|
|
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
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
2024-08-05 22:30:55 +08:00
|
|
|
[componentCls]: {
|
2022-03-14 20:57:01 +08:00
|
|
|
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-11-08 15:37:35 +08:00
|
|
|
[`${componentCls}-search-with-button &`]: {
|
2022-03-14 20:57:01 +08:00
|
|
|
zIndex: 0,
|
|
|
|
},
|
2022-03-09 10:38:02 +08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
|
2022-03-14 20:57:01 +08:00
|
|
|
// Reset rounded corners
|
2022-11-08 15:37:35 +08:00
|
|
|
[`> ${componentCls}:first-child, ${componentCls}-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-11-08 15:37:35 +08:00
|
|
|
[`> ${componentCls}-affix-wrapper`]: {
|
|
|
|
[`&:not(:first-child) ${componentCls}`]: {
|
2022-03-14 20:57:01 +08:00
|
|
|
borderStartStartRadius: 0,
|
|
|
|
borderEndStartRadius: 0,
|
|
|
|
},
|
2022-03-09 10:38:02 +08:00
|
|
|
|
2022-11-08 15:37:35 +08:00
|
|
|
[`&:not(:last-child) ${componentCls}`]: {
|
2022-03-14 20:57:01 +08:00
|
|
|
borderStartEndRadius: 0,
|
|
|
|
borderEndEndRadius: 0,
|
|
|
|
},
|
|
|
|
},
|
2022-03-09 10:38:02 +08:00
|
|
|
|
2022-11-08 15:37:35 +08:00
|
|
|
[`> ${componentCls}:last-child, ${componentCls}-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-11-08 15:37:35 +08:00
|
|
|
[`${componentCls}-affix-wrapper`]: {
|
2022-03-14 20:57:01 +08:00
|
|
|
'&:not(:last-child)': {
|
|
|
|
borderStartEndRadius: 0,
|
|
|
|
borderEndEndRadius: 0,
|
2022-11-08 15:37:35 +08:00
|
|
|
[`${componentCls}-search &`]: {
|
2022-11-01 15:06:38 +08:00
|
|
|
borderStartStartRadius: token.borderRadius,
|
|
|
|
borderEndStartRadius: token.borderRadius,
|
2022-03-14 20:57:01 +08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
|
2022-11-08 15:37:35 +08:00
|
|
|
[`&:not(:first-child), ${componentCls}-search &:not(:first-child)`]: {
|
2022-03-14 20:57:01 +08:00
|
|
|
borderStartStartRadius: 0,
|
|
|
|
borderEndStartRadius: 0,
|
|
|
|
},
|
2022-03-09 10:38:02 +08:00
|
|
|
},
|
|
|
|
|
2023-01-20 10:31:27 +08:00
|
|
|
[`&${componentCls}-group-compact`]: {
|
2022-03-14 20:57:01 +08:00
|
|
|
display: 'block',
|
|
|
|
...clearFix(),
|
2022-03-09 10:38:02 +08:00
|
|
|
|
2022-11-08 15:37:35 +08:00
|
|
|
[`${componentCls}-group-addon, ${componentCls}-group-wrap, > ${componentCls}`]: {
|
2022-03-14 20:57:01 +08:00
|
|
|
'&: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
|
|
|
|
2024-05-22 19:30:07 +08:00
|
|
|
'&:hover, &:focus': {
|
2022-03-14 20:57:01 +08:00
|
|
|
zIndex: 1,
|
|
|
|
},
|
2022-03-09 10:38:02 +08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
|
2022-03-14 20:57:01 +08:00
|
|
|
'& > *': {
|
2024-05-09 17:41:26 +08:00
|
|
|
display: 'inline-flex',
|
2022-03-14 20:57:01 +08:00
|
|
|
float: 'none',
|
|
|
|
verticalAlign: 'top', // https://github.com/ant-design/ant-design-pro/issues/139
|
|
|
|
borderRadius: 0,
|
|
|
|
},
|
2022-03-09 10:38:02 +08:00
|
|
|
|
2023-06-16 18:56:14 +08:00
|
|
|
[`
|
|
|
|
& > ${componentCls}-affix-wrapper,
|
|
|
|
& > ${componentCls}-number-affix-wrapper,
|
|
|
|
& > ${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)': {
|
2023-11-10 17:32:43 +08:00
|
|
|
marginInlineEnd: token.calc(token.lineWidth).mul(-1).equal(),
|
2022-11-01 15:06:38 +08:00
|
|
|
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
|
2024-08-05 22:30:55 +08:00
|
|
|
[componentCls]: {
|
2022-03-14 20:57:01 +08:00
|
|
|
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,
|
2022-11-08 15:37:35 +08:00
|
|
|
& > ${antCls}-select-auto-complete ${componentCls},
|
|
|
|
& > ${antCls}-cascader-picker ${componentCls},
|
|
|
|
& > ${componentCls}-group-wrapper ${componentCls}`]: {
|
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
|
|
|
|
2024-05-22 19:30:07 +08:00
|
|
|
'&:hover, &:focus': {
|
2022-03-14 20:57:01 +08:00
|
|
|
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,
|
2022-11-08 15:37:35 +08:00
|
|
|
& > ${antCls}-select-auto-complete:first-child ${componentCls},
|
|
|
|
& > ${antCls}-cascader-picker:first-child ${componentCls}`]: {
|
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,
|
2022-11-08 15:37:35 +08:00
|
|
|
& > ${antCls}-cascader-picker:last-child ${componentCls},
|
|
|
|
& > ${antCls}-cascader-picker-focused:last-child ${componentCls}`]: {
|
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-11-08 15:37:35 +08:00
|
|
|
[`& > ${antCls}-select-auto-complete ${componentCls}`]: {
|
2022-03-14 20:57:01 +08:00
|
|
|
verticalAlign: 'top',
|
2022-03-09 10:38:02 +08:00
|
|
|
},
|
|
|
|
|
2022-11-08 15:37:35 +08:00
|
|
|
[`${componentCls}-group-wrapper + ${componentCls}-group-wrapper`]: {
|
2023-11-10 17:32:43 +08:00
|
|
|
marginInlineStart: token.calc(token.lineWidth).mul(-1).equal(),
|
2022-11-08 15:37:35 +08:00
|
|
|
[`${componentCls}-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-11-08 15:37:35 +08:00
|
|
|
[`${componentCls}-group-wrapper:not(:last-child)`]: {
|
|
|
|
[`&${componentCls}-search > ${componentCls}-group`]: {
|
|
|
|
[`& > ${componentCls}-group-addon > ${componentCls}-search-button`]: {
|
2022-03-14 20:57:01 +08:00
|
|
|
borderRadius: 0,
|
|
|
|
},
|
|
|
|
|
2022-11-08 15:37:35 +08:00
|
|
|
[`& > ${componentCls}`]: {
|
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) => {
|
2023-11-10 17:32:43 +08:00
|
|
|
const { componentCls, controlHeightSM, lineWidth, calc } = token;
|
2022-03-29 15:57:39 +08:00
|
|
|
|
|
|
|
const FIXED_CHROME_COLOR_HEIGHT = 16;
|
2023-11-10 17:32:43 +08:00
|
|
|
const colorSmallPadding = calc(controlHeightSM)
|
|
|
|
.sub(calc(lineWidth).mul(2))
|
|
|
|
.sub(FIXED_CHROME_COLOR_HEIGHT)
|
|
|
|
.div(2)
|
|
|
|
.equal();
|
2022-03-09 10:38:02 +08:00
|
|
|
|
2022-03-14 20:57:01 +08:00
|
|
|
return {
|
2023-01-17 17:51:59 +08:00
|
|
|
[componentCls]: {
|
2022-03-14 20:57:01 +08:00
|
|
|
...resetComponent(token),
|
|
|
|
...genBasicInputStyle(token),
|
2023-12-18 17:53:31 +08:00
|
|
|
|
|
|
|
// Variants
|
|
|
|
...genOutlinedStyle(token),
|
|
|
|
...genFilledStyle(token),
|
|
|
|
...genBorderlessStyle(token),
|
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-11-08 15:37:35 +08:00
|
|
|
[`&${componentCls}-lg`]: {
|
2022-03-14 20:57:01 +08:00
|
|
|
height: token.controlHeightLG,
|
|
|
|
},
|
2022-11-08 15:37:35 +08:00
|
|
|
[`&${componentCls}-sm`]: {
|
2022-03-29 15:57:39 +08:00
|
|
|
height: controlHeightSM,
|
|
|
|
paddingTop: colorSmallPadding,
|
|
|
|
paddingBottom: colorSmallPadding,
|
2022-03-14 20:57:01 +08:00
|
|
|
},
|
|
|
|
},
|
2023-01-30 17:31:10 +08:00
|
|
|
|
|
|
|
'&[type="search"]::-webkit-search-cancel-button, &[type="search"]::-webkit-search-decoration':
|
|
|
|
{
|
|
|
|
'-webkit-appearance': 'none',
|
|
|
|
},
|
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 => {
|
2022-11-08 15:37:35 +08:00
|
|
|
const { componentCls } = token;
|
2022-03-14 20:57:01 +08:00
|
|
|
return {
|
|
|
|
// ========================= Input =========================
|
2022-11-08 15:37:35 +08:00
|
|
|
[`${componentCls}-clear-icon`]: {
|
2022-03-14 20:57:01 +08:00
|
|
|
margin: 0,
|
2022-12-19 15:21:38 +08:00
|
|
|
color: token.colorTextQuaternary,
|
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-12-19 15:21:38 +08:00
|
|
|
color: token.colorTextTertiary,
|
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': {
|
2023-11-10 17:32:43 +08:00
|
|
|
margin: `0 ${unit(token.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
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
const genAffixStyle: GenerateStyle<InputToken> = (token: InputToken) => {
|
|
|
|
const {
|
2022-11-08 15:37:35 +08:00
|
|
|
componentCls,
|
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;
|
|
|
|
|
2023-12-18 17:53:31 +08:00
|
|
|
const affixCls = `${componentCls}-affix-wrapper`;
|
|
|
|
|
2022-03-14 20:57:01 +08:00
|
|
|
return {
|
2023-12-18 17:53:31 +08:00
|
|
|
[affixCls]: {
|
2022-03-14 20:57:01 +08:00
|
|
|
...genBasicInputStyle(token),
|
|
|
|
display: 'inline-flex',
|
2022-03-09 10:38:02 +08:00
|
|
|
|
2023-12-18 17:53:31 +08:00
|
|
|
[`&:not(${componentCls}-disabled):hover`]: {
|
2022-03-14 20:57:01 +08:00
|
|
|
zIndex: 1,
|
2022-11-08 15:37:35 +08:00
|
|
|
[`${componentCls}-search-with-button &`]: {
|
2022-03-14 20:57:01 +08:00
|
|
|
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-11-08 15:37:35 +08:00
|
|
|
[`> input${componentCls}`]: {
|
2022-03-14 20:57:01 +08:00
|
|
|
padding: 0,
|
2024-04-18 11:00:51 +08:00
|
|
|
},
|
|
|
|
|
|
|
|
[`> input${componentCls}, > textarea${componentCls}`]: {
|
2022-10-11 20:29:55 +08:00
|
|
|
fontSize: 'inherit',
|
2022-03-14 20:57:01 +08:00
|
|
|
border: 'none',
|
2022-11-08 15:37:35 +08:00
|
|
|
borderRadius: 0,
|
2022-03-14 20:57:01 +08:00
|
|
|
outline: 'none',
|
2023-12-18 17:53:31 +08:00
|
|
|
background: 'transparent',
|
|
|
|
color: 'inherit',
|
2022-03-09 10:38:02 +08:00
|
|
|
|
2023-04-12 09:59:31 +08:00
|
|
|
'&::-ms-reveal': {
|
|
|
|
display: 'none',
|
|
|
|
},
|
|
|
|
|
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': {
|
2023-06-16 18:56:14 +08:00
|
|
|
display: 'inline-block',
|
2022-03-14 20:57:01 +08:00
|
|
|
width: 0,
|
|
|
|
visibility: 'hidden',
|
|
|
|
content: '"\\a0"',
|
|
|
|
},
|
2022-03-09 10:38:02 +08:00
|
|
|
|
2024-08-05 22:30:55 +08:00
|
|
|
[componentCls]: {
|
2022-03-14 20:57:01 +08:00
|
|
|
'&-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-11-08 15:37:35 +08:00
|
|
|
[`${iconCls}${componentCls}-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
|
|
|
};
|
|
|
|
};
|
2022-03-09 10:38:02 +08:00
|
|
|
|
2022-03-14 20:57:01 +08:00
|
|
|
const genGroupStyle: GenerateStyle<InputToken> = (token: InputToken) => {
|
2023-12-18 17:53:31 +08:00
|
|
|
const { componentCls, borderRadiusLG, borderRadiusSM } = token;
|
2022-03-09 10:38:02 +08:00
|
|
|
|
2022-03-14 20:57:01 +08:00
|
|
|
return {
|
2022-11-08 15:37:35 +08:00
|
|
|
[`${componentCls}-group`]: {
|
2022-03-14 20:57:01 +08:00
|
|
|
// 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,
|
2024-01-09 15:18:44 +08:00
|
|
|
fontSize: token.inputFontSizeLG,
|
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
|
|
|
|
2023-12-18 17:53:31 +08:00
|
|
|
// Variants
|
|
|
|
...genOutlinedGroupStyle(token),
|
|
|
|
...genFilledGroupStyle(token),
|
2023-02-17 15:45:29 +08:00
|
|
|
|
2023-12-18 17:53:31 +08:00
|
|
|
// '&-disabled': {
|
|
|
|
// [`${componentCls}-group-addon`]: {
|
|
|
|
// ...genDisabledStyle(token),
|
|
|
|
// },
|
|
|
|
// },
|
2023-05-08 14:03:54 +08:00
|
|
|
|
|
|
|
// Fix the issue of using icons in Space Compact mode
|
|
|
|
// https://github.com/ant-design/ant-design/issues/42122
|
|
|
|
[`&: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,
|
|
|
|
},
|
|
|
|
},
|
2024-01-27 20:36:50 +08:00
|
|
|
|
|
|
|
// Fix the issue of input use show-count param in space compact mode
|
|
|
|
// https://github.com/ant-design/ant-design/issues/46872
|
|
|
|
[`&:not(${componentCls}-compact-last-item)${componentCls}-compact-item`]: {
|
|
|
|
[`${componentCls}-affix-wrapper`]: {
|
|
|
|
borderStartEndRadius: 0,
|
|
|
|
borderEndEndRadius: 0,
|
|
|
|
},
|
|
|
|
},
|
2022-03-14 20:57:01 +08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
const genSearchInputStyle: GenerateStyle<InputToken> = (token: InputToken) => {
|
2022-11-08 15:37:35 +08:00
|
|
|
const { componentCls, antCls } = token;
|
|
|
|
const searchPrefixCls = `${componentCls}-search`;
|
2022-03-14 20:57:01 +08:00
|
|
|
return {
|
|
|
|
[searchPrefixCls]: {
|
2024-08-05 22:30:55 +08:00
|
|
|
[componentCls]: {
|
2022-03-14 20:57:01 +08:00
|
|
|
'&:hover, &:focus': {
|
2022-03-22 20:02:04 +08:00
|
|
|
borderColor: token.colorPrimaryHover,
|
2022-03-14 20:57:01 +08:00
|
|
|
|
2022-11-19 21:49:11 +08:00
|
|
|
[`+ ${componentCls}-group-addon ${searchPrefixCls}-button:not(${antCls}-btn-primary)`]: {
|
|
|
|
borderInlineStartColor: token.colorPrimaryHover,
|
|
|
|
},
|
2022-03-14 20:57:01 +08:00
|
|
|
},
|
|
|
|
},
|
2022-03-09 10:38:02 +08:00
|
|
|
|
2022-11-08 15:37:35 +08:00
|
|
|
[`${componentCls}-affix-wrapper`]: {
|
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
|
|
|
// fix slight height diff in Firefox:
|
2024-07-23 22:22:24 +08:00
|
|
|
// https://ant.design/components/auto-complete-cn/#auto-complete-demo-certain-category
|
2022-11-08 15:37:35 +08:00
|
|
|
[`${componentCls}-lg`]: {
|
2024-06-05 20:01:19 +08:00
|
|
|
lineHeight: token.calc(token.lineHeightLG).sub(0.0002).equal(),
|
2022-03-14 20:57:01 +08:00
|
|
|
},
|
|
|
|
|
2022-11-08 15:37:35 +08:00
|
|
|
[`> ${componentCls}-group`]: {
|
|
|
|
[`> ${componentCls}-group-addon:last-child`]: {
|
2022-03-14 20:57:01 +08:00
|
|
|
insetInlineStart: -1,
|
|
|
|
padding: 0,
|
|
|
|
border: 0,
|
2022-03-09 10:38:02 +08:00
|
|
|
|
2022-03-14 20:57:01 +08:00
|
|
|
[`${searchPrefixCls}-button`]: {
|
2024-01-27 23:18:51 +08:00
|
|
|
// Fix https://github.com/ant-design/ant-design/issues/47150
|
|
|
|
marginInlineEnd: -1,
|
2022-03-14 20:57:01 +08:00
|
|
|
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,
|
2023-09-06 20:04:56 +08:00
|
|
|
boxShadow: 'none',
|
2022-03-14 20:57:01 +08:00
|
|
|
},
|
|
|
|
|
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 =====================
|
2022-11-08 15:37:35 +08:00
|
|
|
[`&${componentCls}-compact-item`]: {
|
|
|
|
[`&:not(${componentCls}-compact-last-item)`]: {
|
|
|
|
[`${componentCls}-group-addon`]: {
|
|
|
|
[`${componentCls}-search-button`]: {
|
2023-11-10 17:32:43 +08:00
|
|
|
marginInlineEnd: token.calc(token.lineWidth).mul(-1).equal(),
|
2022-10-28 16:09:38 +08:00
|
|
|
borderRadius: 0,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
2022-11-08 15:37:35 +08:00
|
|
|
[`&:not(${componentCls}-compact-first-item)`]: {
|
|
|
|
[`${componentCls},${componentCls}-affix-wrapper`]: {
|
2022-10-28 16:09:38 +08:00
|
|
|
borderRadius: 0,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
2022-11-08 15:37:35 +08:00
|
|
|
[`> ${componentCls}-group-addon ${componentCls}-search-button,
|
|
|
|
> ${componentCls},
|
|
|
|
${componentCls}-affix-wrapper`]: {
|
2024-05-22 19:30:07 +08:00
|
|
|
'&:hover, &:focus, &:active': {
|
2022-10-28 16:09:38 +08:00
|
|
|
zIndex: 2,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
2022-11-08 15:37:35 +08:00
|
|
|
[`> ${componentCls}-affix-wrapper-focused`]: {
|
2022-10-28 16:09:38 +08:00
|
|
|
zIndex: 2,
|
|
|
|
},
|
|
|
|
},
|
2022-03-14 20:57:01 +08:00
|
|
|
},
|
|
|
|
};
|
|
|
|
};
|
2022-03-09 10:38:02 +08:00
|
|
|
|
2022-11-17 23:31:41 +08:00
|
|
|
const genTextAreaStyle: GenerateStyle<InputToken> = (token) => {
|
2023-01-11 14:18:13 +08:00
|
|
|
const { componentCls, paddingLG } = token;
|
2022-11-08 15:37:35 +08:00
|
|
|
const textareaPrefixCls = `${componentCls}-textarea`;
|
2022-03-14 20:57:01 +08:00
|
|
|
|
|
|
|
return {
|
|
|
|
[textareaPrefixCls]: {
|
2022-03-29 15:57:39 +08:00
|
|
|
position: 'relative',
|
|
|
|
|
2022-03-25 20:08:05 +08:00
|
|
|
'&-show-count': {
|
|
|
|
// https://github.com/ant-design/ant-design/issues/33049
|
2022-11-08 15:37:35 +08:00
|
|
|
[`> ${componentCls}`]: {
|
2022-03-25 20:08:05 +08:00
|
|
|
height: '100%',
|
|
|
|
},
|
|
|
|
|
2023-01-11 14:18:13 +08:00
|
|
|
[`${componentCls}-data-count`]: {
|
2023-03-27 10:33:52 +08:00
|
|
|
position: 'absolute',
|
2023-11-10 17:32:43 +08:00
|
|
|
bottom: token.calc(token.fontSize).mul(token.lineHeight).mul(-1).equal(),
|
2023-03-27 10:33:52 +08:00
|
|
|
insetInlineEnd: 0,
|
2022-08-04 16:16:50 +08:00
|
|
|
color: token.colorTextDescription,
|
2022-03-25 20:08:05 +08:00
|
|
|
whiteSpace: 'nowrap',
|
|
|
|
pointerEvents: 'none',
|
2022-12-01 20:16:23 +08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
|
2024-05-22 19:30:07 +08:00
|
|
|
[`
|
|
|
|
&-allow-clear > ${componentCls},
|
|
|
|
&-affix-wrapper${textareaPrefixCls}-has-feedback ${componentCls}
|
|
|
|
`]: {
|
|
|
|
paddingInlineEnd: paddingLG,
|
2023-01-11 14:18:13 +08:00
|
|
|
},
|
|
|
|
|
|
|
|
[`&-affix-wrapper${componentCls}-affix-wrapper`]: {
|
|
|
|
padding: 0,
|
|
|
|
|
|
|
|
[`> textarea${componentCls}`]: {
|
|
|
|
fontSize: 'inherit',
|
|
|
|
border: 'none',
|
|
|
|
outline: 'none',
|
2023-12-18 17:53:31 +08:00
|
|
|
background: 'transparent',
|
2023-01-11 14:18:13 +08:00
|
|
|
|
|
|
|
'&:focus': {
|
|
|
|
boxShadow: 'none !important',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
[`${componentCls}-suffix`]: {
|
|
|
|
margin: 0,
|
|
|
|
|
|
|
|
'> *:not(:last-child)': {
|
|
|
|
marginInline: 0,
|
|
|
|
},
|
|
|
|
|
|
|
|
// Clear Icon
|
|
|
|
[`${componentCls}-clear-icon`]: {
|
|
|
|
position: 'absolute',
|
2024-07-04 15:25:09 +08:00
|
|
|
insetInlineEnd: token.paddingInline,
|
2023-01-11 14:18:13 +08:00
|
|
|
insetBlockStart: token.paddingXS,
|
|
|
|
},
|
|
|
|
|
|
|
|
// Feedback Icon
|
|
|
|
[`${textareaPrefixCls}-suffix`]: {
|
|
|
|
position: 'absolute',
|
|
|
|
top: 0,
|
2023-08-22 09:38:11 +08:00
|
|
|
insetInlineEnd: token.paddingInline,
|
2023-01-11 14:18:13 +08:00
|
|
|
bottom: 0,
|
|
|
|
zIndex: 1,
|
|
|
|
display: 'inline-flex',
|
|
|
|
alignItems: 'center',
|
|
|
|
margin: 'auto',
|
|
|
|
pointerEvents: 'none',
|
|
|
|
},
|
2022-03-25 20:08:05 +08:00
|
|
|
},
|
|
|
|
},
|
2024-07-04 15:25:09 +08:00
|
|
|
|
|
|
|
[`&-affix-wrapper${componentCls}-affix-wrapper-sm`]: {
|
|
|
|
[`${componentCls}-suffix`]: {
|
|
|
|
[`${componentCls}-clear-icon`]: {
|
|
|
|
insetInlineEnd: token.paddingInlineSM,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2022-03-14 20:57:01 +08:00
|
|
|
},
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2023-10-10 16:22:23 +08:00
|
|
|
// ============================== Range ===============================
|
|
|
|
const genRangeStyle: GenerateStyle<InputToken> = (token) => {
|
|
|
|
const { componentCls } = token;
|
|
|
|
|
|
|
|
return {
|
|
|
|
[`${componentCls}-out-of-range`]: {
|
|
|
|
[`&, & input, & textarea, ${componentCls}-show-count-suffix, ${componentCls}-data-count`]: {
|
|
|
|
color: token.colorError,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2022-03-09 10:38:02 +08:00
|
|
|
// ============================== Export ==============================
|
2023-11-29 17:23:45 +08:00
|
|
|
export default genStyleHooks(
|
2023-08-22 09:38:11 +08:00
|
|
|
'Input',
|
|
|
|
(token) => {
|
|
|
|
const inputToken = mergeToken<InputToken>(token, initInputToken(token));
|
|
|
|
|
|
|
|
return [
|
|
|
|
genInputStyle(inputToken),
|
|
|
|
genTextAreaStyle(inputToken),
|
|
|
|
genAffixStyle(inputToken),
|
|
|
|
genGroupStyle(inputToken),
|
|
|
|
genSearchInputStyle(inputToken),
|
2023-10-10 16:22:23 +08:00
|
|
|
genRangeStyle(inputToken),
|
2023-08-22 09:38:11 +08:00
|
|
|
// =====================================================
|
|
|
|
// == Space Compact ==
|
|
|
|
// =====================================================
|
|
|
|
genCompactItemStyle(inputToken),
|
|
|
|
];
|
|
|
|
},
|
|
|
|
initComponentToken,
|
2024-04-18 16:06:35 +08:00
|
|
|
{
|
|
|
|
resetFont: false,
|
|
|
|
},
|
2023-08-22 09:38:11 +08:00
|
|
|
);
|