@@ -256,7 +256,7 @@ export class InputOTP implements ComponentInterface {
256256 if ( this . value != null && String ( this . value ) . length > 0 ) {
257257 const chars = String ( this . value ) . split ( '' ) . slice ( 0 , this . length ) ;
258258 chars . forEach ( ( char , index ) => {
259- if ( this . validKeys . test ( char ) ) {
259+ if ( this . validKeyPattern . test ( char ) ) {
260260 this . inputValues [ index ] = char ;
261261 }
262262 } ) ;
@@ -305,7 +305,7 @@ export class InputOTP implements ComponentInterface {
305305 * If a pattern is provided, use it to create a regex pattern
306306 * Otherwise, use the default regex pattern based on type
307307 */
308- private get validKeys ( ) : RegExp {
308+ private get validKeyPattern ( ) : RegExp {
309309 return new RegExp ( `^${ this . getPattern ( ) } $` ) ;
310310 }
311311
@@ -383,12 +383,12 @@ export class InputOTP implements ComponentInterface {
383383 }
384384
385385 private onInput = ( index : number ) => ( event : InputEvent ) => {
386- const { validKeys } = this ;
386+ const { validKeyPattern } = this ;
387387
388388 const value = ( event . target as HTMLInputElement ) . value ;
389389
390390 // Only allow input if it's a single character and matches the pattern
391- if ( value . length > 1 || ( value . length > 0 && ! validKeys . test ( value ) ) ) {
391+ if ( value . length > 1 || ( value . length > 0 && ! validKeyPattern . test ( value ) ) ) {
392392 // Reset the input value if not valid
393393 this . inputRefs [ index ] . value = '' ;
394394 this . inputValues [ index ] = '' ;
@@ -494,7 +494,7 @@ export class InputOTP implements ComponentInterface {
494494 // If the input box contains a value and the key being
495495 // entered is a valid key for the input box update the value
496496 // and shift the values to the right if there is room.
497- if ( this . inputValues [ index ] && this . validKeys . test ( event . key ) ) {
497+ if ( this . inputValues [ index ] && this . validKeyPattern . test ( event . key ) ) {
498498 if ( ! this . inputValues [ length - 1 ] ) {
499499 for ( let i = length - 1 ; i > index ; i -- ) {
500500 this . inputValues [ i ] = this . inputValues [ i - 1 ] ;
@@ -519,7 +519,7 @@ export class InputOTP implements ComponentInterface {
519519 * the next empty input after pasting.
520520 */
521521 private onPaste = ( event : ClipboardEvent ) => {
522- const { inputRefs, length, validKeys } = this ;
522+ const { inputRefs, length, validKeyPattern } = this ;
523523
524524 event . preventDefault ( ) ;
525525
@@ -535,7 +535,7 @@ export class InputOTP implements ComponentInterface {
535535
536536 const validChars = pastedText
537537 . split ( '' )
538- . filter ( ( char ) => validKeys . test ( char ) )
538+ . filter ( ( char ) => validKeyPattern . test ( char ) )
539539 . slice ( 0 , length ) ;
540540
541541 // Find the first empty input
0 commit comments