Skip to content

Commit

Permalink
feat(input): use type enum & manage padding with search and clearable
Browse files Browse the repository at this point in the history
Signed-off-by: astagnol <[email protected]>
  • Loading branch information
astagnol authored and dpellier committed Nov 28, 2024
1 parent 8b46c6b commit 78b7ccb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,19 @@
}
}

&--clearable, &--loading, &--toggle-mask {
&--clearable, &--loading, &--toggle-mask, &--search {
padding-right: input.$ods-input-input-padding-right;
}

&.ods-input__input--clearable.ods-input__input--toggle-mask {
padding-right: calc(input.$ods-input-input-padding-right * 2);
&--clearable {
&.ods-input__input--toggle-mask,
&.ods-input__input--search {
padding-right: calc(input.$ods-input-input-padding-right * 2);
}
}

&--clearable.ods-input__input--toggle-mask.ods-input__input--search {
padding-right: calc(input.$ods-input-input-padding-right * 3);
}

&[type="number"] {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ export class OdsInput {
render(): FunctionalComponent {
const hasClearableIcon = this.isClearable && !this.isLoading && !!this.value;
const hasToggleMaskIcon = this.isPassword && !this.isLoading;
const hasSearchIcon = this.type === 'search' && !this.isLoading;
const hasSearchIcon = this.type === ODS_INPUT_TYPE.search && !this.isLoading;

return (
<Host
Expand All @@ -280,6 +280,7 @@ export class OdsInput {
'ods-input__input--clearable': hasClearableIcon,
'ods-input__input--error': this.hasError || this.isInvalid,
'ods-input__input--loading': this.isLoading,
'ods-input__input--search': hasSearchIcon,
'ods-input__input--toggle-mask': hasToggleMaskIcon,
}}
disabled={ this.isDisabled }
Expand Down

0 comments on commit 78b7ccb

Please sign in to comment.