1- import { html , nothing } from 'lit' ;
1+ import { html } from 'lit' ;
22import { property } from 'lit/decorators.js' ;
33import { ifDefined } from 'lit/directives/if-defined.js' ;
44import { live } from 'lit/directives/live.js' ;
55
66import { registerComponent } from '../common/definitions/register.js' ;
77import { createFormValueState } from '../common/mixins/forms/form-value.js' ;
88import { partMap } from '../common/part-map.js' ;
9- import { isEmpty } from '../common/util.js' ;
9+ import { bindIf , isEmpty } from '../common/util.js' ;
1010import type { InputType , RangeTextSelectMode } from '../types.js' ;
1111import IgcValidationContainerComponent from '../validation-container/validation-container.js' ;
1212import { IgcInputBaseComponent } from './input-base.js' ;
@@ -199,12 +199,6 @@ export default class IgcInputComponent extends IgcInputBaseComponent {
199199 @property ( { type : Boolean , reflect : true , attribute : 'validate-only' } )
200200 public validateOnly = false ;
201201
202- /**
203- * @internal
204- */
205- @property ( { type : Number } )
206- public override tabIndex = 0 ;
207-
208202 /* blazorSuppress */
209203 /** Replaces the selected text in the input. */
210204 public override setRangeText (
@@ -247,6 +241,9 @@ export default class IgcInputComponent extends IgcInputBaseComponent {
247241 }
248242
249243 protected renderInput ( ) {
244+ const hasNegativeTabIndex = this . getAttribute ( 'tabindex' ) === '-1' ;
245+ const hasHelperText = ! isEmpty ( this . _helperText ) ;
246+
250247 return html `
251248 < input
252249 id =${ this . inputId }
@@ -260,17 +257,15 @@ export default class IgcInputComponent extends IgcInputBaseComponent {
260257 ?disabled=${ this . disabled }
261258 ?required=${ this . required }
262259 ?autofocus=${ this . autofocus }
263- tabindex=${ this . tabIndex }
260+ tabindex=${ bindIf ( hasNegativeTabIndex , - 1 ) }
264261 autocomplete=${ ifDefined ( this . autocomplete as any ) }
265262 inputmode=${ ifDefined ( this . inputMode ) }
266- min=${ ifDefined ( this . validateOnly ? undefined : this . min ) }
267- max=${ ifDefined ( this . validateOnly ? undefined : this . max ) }
263+ min=${ bindIf ( ! this . validateOnly , this . min ) }
264+ max=${ bindIf ( ! this . validateOnly , this . max ) }
268265 minlength=${ ifDefined ( this . minLength ) }
269- maxlength=${ ifDefined ( this . validateOnly ? undefined : this . maxLength ) }
266+ maxlength=${ bindIf ( ! this . validateOnly , this . maxLength ) }
270267 step=${ ifDefined ( this . step ) }
271- aria-describedby=${ ifDefined (
272- isEmpty ( this . _helperText ) ? nothing : 'helper-text'
273- ) }
268+ aria-describedby=${ bindIf ( hasHelperText , 'helper-text' ) }
274269 @change=${ this . handleChange }
275270 @input=${ this . handleInput }
276271 @blur=${ this . _handleBlur }
0 commit comments