Skip to content

Commit

Permalink
fix incorrect padding for text-field prefix and suffix #327
Browse files Browse the repository at this point in the history
  • Loading branch information
zdhxiong committed Jul 15, 2024
1 parent ae4cce7 commit 5ab270e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions packages/mdui/src/components/text-field/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -750,6 +750,8 @@ export class TextField
const hasEndIcon =
!!this.endIcon || this.hasSlotController.test('end-icon');
const hasErrorIcon = this.invalid || this.invalidStyle;
const hasPrefix = !!this.prefix || this.hasSlotController.test('prefix');
const hasSuffix = !!this.suffix || this.hasSlotController.test('suffix');
const hasHelper = !!this.helper || this.hasSlotController.test('helper');
const hasError =
hasErrorIcon && !!(this.error || this.inputRef.value!.validationMessage);
Expand All @@ -768,6 +770,8 @@ export class TextField
'has-icon': hasIcon,
'has-end-icon': hasEndIcon,
'has-error-icon': hasErrorIcon,
'has-prefix': hasPrefix,
'has-suffix': hasSuffix,
'is-firefox': navigator.userAgent.includes('Firefox'),
...invalidClassNameObj,
});
Expand Down
4 changes: 2 additions & 2 deletions packages/mdui/src/components/text-field/style.less
Original file line number Diff line number Diff line change
Expand Up @@ -177,11 +177,11 @@
}
}

.prefix {
.has-prefix .prefix {
.padding-right(2);
}

.suffix {
.has-suffix .suffix {
.padding-left(2);
}

Expand Down

0 comments on commit 5ab270e

Please sign in to comment.