Skip to content

Commit 1ed63ec

Browse files
authored
fix: the style of form-item (#31)
1 parent f4b8843 commit 1ed63ec

File tree

1 file changed

+15
-11
lines changed
  • packages/components/src/form-item/style

1 file changed

+15
-11
lines changed

packages/components/src/form-item/style/other.tsx

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ export const genOtherStyle: GenerateStyle = (token) => {
2121
lineHeight,
2222
controlOutlineWidth,
2323
controlOutline,
24-
colorPrimaryHover,
24+
colorErrorOutline,
25+
colorWarningOutline,
2526
colorTextSecondary,
2627
paddingXS,
2728
} = token
@@ -31,11 +32,14 @@ export const genOtherStyle: GenerateStyle = (token) => {
3132
borderInlineEndWidth: lineWidth,
3233
})
3334

34-
const active = (color = colorPrimary): CSSProperties => ({
35+
const active = (
36+
color = colorPrimary,
37+
outlineColor = controlOutline
38+
): CSSProperties => ({
3539
borderColor: color,
3640
borderInlineEndWidth: lineWidth,
3741
outline: 0,
38-
boxShadow: `${controlOutlineWidth} 0 ${controlOutline} ${colorPrimaryHover}`,
42+
boxShadow: `0 0 0 ${controlOutlineWidth}px ${outlineColor}`,
3943
})
4044

4145
const extraLabelHeight = controlHeightSM - 2
@@ -126,7 +130,7 @@ export const genOtherStyle: GenerateStyle = (token) => {
126130

127131
[`&${antCls}-select-open ${antCls}-select-selector,
128132
&${antCls}-select-focused ${antCls}-select-selector`]: {
129-
...active(colorWarning),
133+
...active(colorWarning, colorWarningOutline),
130134
},
131135
},
132136

@@ -137,7 +141,7 @@ export const genOtherStyle: GenerateStyle = (token) => {
137141

138142
[`&-focused,
139143
&:focus`]: {
140-
...active(colorWarning),
144+
...active(colorWarning, colorWarningOutline),
141145
},
142146

143147
'&:not([disabled]):hover': {
@@ -148,14 +152,14 @@ export const genOtherStyle: GenerateStyle = (token) => {
148152

149153
[`${antCls}-cascader-picker:focus ${antCls}-cascader-input`]: {
150154
backgroundColor: colorWarningBg,
151-
...active(colorWarning),
155+
...active(colorWarning, colorWarningOutline),
152156
},
153157

154158
[`${antCls}-input-affix-wrapper-focused,
155159
${antCls}-input-affix-wrapper:focus,
156160
${antCls}-input-focused,
157161
${antCls}-input:focus`]: {
158-
...active(colorWarning),
162+
...active(colorWarning, colorWarningOutline),
159163
},
160164
},
161165

@@ -189,7 +193,7 @@ export const genOtherStyle: GenerateStyle = (token) => {
189193

190194
[`&${antCls}-select-open ${antCls}-select-selector,
191195
&${antCls}-select-focused ${antCls}-select-selector`]: {
192-
...active(colorError),
196+
...active(colorError, colorErrorOutline),
193197
},
194198
},
195199

@@ -199,7 +203,7 @@ export const genOtherStyle: GenerateStyle = (token) => {
199203

200204
[`&-focused,
201205
&:focus`]: {
202-
...active(colorError),
206+
...active(colorError, colorErrorOutline),
203207
},
204208

205209
[`&:not([disabled]):hover`]: {
@@ -208,14 +212,14 @@ export const genOtherStyle: GenerateStyle = (token) => {
208212
},
209213

210214
[`${antCls}-cascader-picker:focus ${antCls}-cascader-input`]: {
211-
...active(colorError),
215+
...active(colorError, colorErrorOutline),
212216
},
213217

214218
[`${antCls}-input-affix-wrapper-focused,
215219
${antCls}-input-affix-wrapper:focus,
216220
${antCls}-input-focused,
217221
${antCls}-input:focus`]: {
218-
...active(colorError),
222+
...active(colorError, colorErrorOutline),
219223
},
220224
},
221225

0 commit comments

Comments
 (0)