@@ -22,11 +22,37 @@ export class UUIInputLockElement extends UUIInputElement {
2222 * @default true
2323 */
2424 @property ( { type : Boolean , reflect : true } )
25- public locked : boolean = true ;
25+ public set locked ( lock : boolean ) {
26+ this . #locked = lock ;
27+ this . tabIndex = lock ? - 1 : 0 ;
28+ }
29+ public get locked ( ) : boolean {
30+ return this . #locked;
31+ }
32+ #locked: boolean = true ;
33+
34+ /**
35+ * Define the label for the unlock button.
36+ * @type {string }
37+ * @attr
38+ * @default true
39+ */
40+ @property ( { type : String , reflect : false , attribute : 'unlock-label' } )
41+ public unlockLabel : string = 'Unlock input' ;
42+
43+ /**
44+ * Define the label for the lock button.
45+ * @type {string }
46+ * @attr
47+ * @default true
48+ */
49+ @property ( { type : String , reflect : false , attribute : 'lock-label' } )
50+ public lockLabel : string = 'Lock input' ;
2651
2752 constructor ( ) {
2853 super ( ) ;
2954 this . readonly = true ;
55+ this . tabIndex = - 1 ;
3056 }
3157
3258 connectedCallback ( ) : void {
@@ -40,6 +66,9 @@ export class UUIInputLockElement extends UUIInputElement {
4066 this . readonly = this . locked = ! this . locked ;
4167 this . pristine = false ;
4268 this . dispatchEvent ( new UUIInputLockEvent ( UUIInputLockEvent . LOCK_CHANGE ) ) ;
69+ if ( ! this . locked ) {
70+ this . _input ?. focus ( ) ;
71+ }
4372 }
4473
4574 renderIcon ( ) {
@@ -56,7 +85,7 @@ export class UUIInputLockElement extends UUIInputElement {
5685 @click = ${ this . _onLockToggle }
5786 compact
5887 id= "lock"
59- label = "${ this . locked ? 'Unlock input' : 'Lock input' } " >
88+ label = "${ this . locked ? this . unlockLabel : this . lockLabel } " >
6089 ${ this . renderIcon ( ) }
6190 </ uui- butto n> ` ;
6291 }
0 commit comments