@@ -22,11 +22,37 @@ export class UUIInputLockElement extends UUIInputElement {
22
22
* @default true
23
23
*/
24
24
@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' ;
26
51
27
52
constructor ( ) {
28
53
super ( ) ;
29
54
this . readonly = true ;
55
+ this . tabIndex = - 1 ;
30
56
}
31
57
32
58
connectedCallback ( ) : void {
@@ -40,6 +66,9 @@ export class UUIInputLockElement extends UUIInputElement {
40
66
this . readonly = this . locked = ! this . locked ;
41
67
this . pristine = false ;
42
68
this . dispatchEvent ( new UUIInputLockEvent ( UUIInputLockEvent . LOCK_CHANGE ) ) ;
69
+ if ( ! this . locked ) {
70
+ this . _input ?. focus ( ) ;
71
+ }
43
72
}
44
73
45
74
renderIcon ( ) {
@@ -56,7 +85,7 @@ export class UUIInputLockElement extends UUIInputElement {
56
85
@click = ${ this . _onLockToggle }
57
86
compact
58
87
id= "lock"
59
- label = "${ this . locked ? 'Unlock input' : 'Lock input' } " >
88
+ label = "${ this . locked ? this . unlockLabel : this . lockLabel } " >
60
89
${ this . renderIcon ( ) }
61
90
</ uui- butto n> ` ;
62
91
}
0 commit comments