Skip to content

Commit ebd52af

Browse files
committed
refactor: form input css
1 parent b02af56 commit ebd52af

File tree

3 files changed

+29
-29
lines changed

3 files changed

+29
-29
lines changed

components/form/style/mixin.less

Lines changed: 11 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
11
@import '../../input/style/mixin';
22

3-
.form-control-validation(@text-color: @input-color; @border-color: @input-border-color; @background-color: @input-bg) {
3+
.form-control-validation(
4+
@text-color: @input-color;
5+
@border-color: @input-border-color;
6+
@background-color: @input-bg;
7+
@hoverBorderColor: @primary-color-hover;
8+
@outlineColor: @primary-color-outline;
9+
) {
410
.@{ant-prefix}-form-item-split {
511
color: @text-color;
612
}
713
// 输入框的不同校验状态
8-
.@{ant-prefix}-input,
9-
.@{ant-prefix}-input-affix-wrapper {
14+
:not(.@{ant-prefix}-input-disabled):not(.@{ant-prefix}-input-borderless).@{ant-prefix}-input,
15+
:not(.@{ant-prefix}-input-affix-wrapper-disabled):not(.@{ant-prefix}-input-affix-wrapper-borderless).@{ant-prefix}-input-affix-wrapper {
1016
&,
1117
&:hover {
1218
background-color: @background-color;
@@ -15,32 +21,12 @@
1521

1622
&:focus,
1723
&-focused {
18-
.active(@border-color);
19-
}
20-
}
21-
22-
.@{ant-prefix}-input-disabled {
23-
&,
24-
&:hover {
25-
background-color: @input-disabled-bg;
26-
border-color: @input-border-color;
27-
}
28-
}
29-
30-
.@{ant-prefix}-input-affix-wrapper-disabled {
31-
&,
32-
&:hover {
33-
background-color: @input-disabled-bg;
34-
border-color: @input-border-color;
35-
36-
input:focus {
37-
box-shadow: none !important;
38-
}
24+
.active(@border-color, @hoverBorderColor, @outlineColor);
3925
}
4026
}
4127

4228
.@{ant-prefix}-calendar-picker-open .@{ant-prefix}-calendar-picker-input {
43-
.active(@border-color);
29+
.active(@border-color, @hoverBorderColor, @outlineColor);
4430
}
4531

4632
.@{ant-prefix}-input-prefix {

components/form/style/status.less

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@
118118

119119
// ======================== Warning ========================
120120
&-has-warning {
121-
.form-control-validation(@warning-color; @warning-color; @form-warning-input-bg);
121+
.form-control-validation(@warning-color; @warning-color; @form-warning-input-bg; @warning-color-hover; @warning-color-outline);
122122

123123
&.@{form-item-prefix-cls}-has-feedback .@{form-item-prefix-cls}-children-icon {
124124
color: @warning-color;
@@ -159,7 +159,7 @@
159159

160160
// ========================= Error =========================
161161
&-has-error {
162-
.form-control-validation(@error-color; @error-color; @form-error-input-bg);
162+
.form-control-validation(@error-color; @error-color; @form-error-input-bg; @error-color-hover; @error-color-outline);
163163

164164
&.@{form-item-prefix-cls}-has-feedback .@{form-item-prefix-cls}-children-icon {
165165
color: @error-color;

components/style/themes/default.less

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,27 @@
1717
@info-color: @primary-color;
1818
@success-color: @green-6;
1919
@processing-color: @blue-6;
20-
@error-color: @red-5;
2120
@highlight-color: @red-5;
22-
@warning-color: @gold-6;
2321
@normal-color: #d9d9d9;
2422
@white: #fff;
2523
@black: #000;
2624

25+
// >>> Warning
26+
@warning-color: @gold-6;
27+
@warning-color-hover: color(~`colorPalette('@{warning-color}', 5) `);
28+
@warning-color-active: color(~`colorPalette('@{warning-color}', 7) `);
29+
@warning-color-outline: fade(@warning-color, @outline-fade);
30+
@warning-color-deprecated-bg: color(~`colorPalette('@{warning-color}', 1) `);
31+
@warning-color-deprecated-border: color(~`colorPalette('@{warning-color}', 3) `);
32+
33+
// >>> Error
34+
@error-color: @red-5;
35+
@error-color-hover: color(~`colorPalette('@{error-color}', 5) `);
36+
@error-color-active: color(~`colorPalette('@{error-color}', 7) `);
37+
@error-color-outline: fade(@error-color, @outline-fade);
38+
@error-color-deprecated-bg: color(~`colorPalette('@{error-color}', 1) `);
39+
@error-color-deprecated-border: color(~`colorPalette('@{error-color}', 3) `);
40+
2741
// Color used by default to control hover and active backgrounds and for
2842
// alert info backgrounds.
2943
@primary-1: color(~`colorPalette('@{primary-color}', 1) `); // replace tint(@primary-color, 90%)

0 commit comments

Comments
 (0)