File tree Expand file tree Collapse file tree 3 files changed +41
-5
lines changed
pgml-dashboard/src/components/inputs/range_group_v_2 Expand file tree Collapse file tree 3 files changed +41
-5
lines changed Original file line number Diff line number Diff line change @@ -5,11 +5,31 @@ div[data-controller="inputs-range-group-v-2"] {
5
5
}
6
6
7
7
input [type = " text" ] {
8
- padding-right : 30px ;
8
+ padding-right : 0 ;
9
+ border-right : 0 ;
10
+ border-top-right-radius : 0 ;
11
+ border-bottom-right-radius : 0 ;
9
12
}
10
13
11
14
.inputs-range-group-v-2-unit {
12
- margin-left : -33px ;
13
15
color : #{$gray-400 } ;
16
+ background : #{$input-bg } ;
17
+ height : 100% ;
18
+ padding : #{$input-padding-y } #{$input-padding-x } ;
19
+ border : #{$input-border-width } solid #{$input-border-color } ;
20
+
21
+ border-top-right-radius : var (--bs-border-radius );
22
+ border-bottom-right-radius : var (--bs-border-radius );
23
+ border-top-left-radius : 0 ;
24
+ border-bottom-left-radius : 0 ;
25
+ border-left : 0 ;
26
+ transition : #{$input-transition } ;
27
+
28
+ & .focused {
29
+ background : #{$input-focus-bg } ;
30
+ box-shadow : #{$input-focus-box-shadow } ;
31
+ border-color : #{$input-focus-border-color } ;
32
+ border-width : #{$input-border-width } ;
33
+ }
14
34
}
15
35
}
Original file line number Diff line number Diff line change 1
1
import { Controller } from "@hotwired/stimulus" ;
2
2
3
3
export default class extends Controller {
4
- static targets = [ "input" , "range" ] ;
4
+ static targets = [ "input" , "range" , "unit" ] ;
5
5
6
6
onInputInput ( e ) {
7
7
const value = parseInt ( e . currentTarget . value ) ;
@@ -14,6 +14,18 @@ export default class extends Controller {
14
14
}
15
15
}
16
16
17
+ onInputFocusIn ( e ) {
18
+ this . unitTarget . classList . add ( "focused" ) ;
19
+ }
20
+
21
+ onInputBlur ( e ) {
22
+ this . unitTarget . classList . remove ( "focused" ) ;
23
+ }
24
+
25
+ onUnitClick ( e ) {
26
+ this . inputTarget . focus ( ) ;
27
+ }
28
+
17
29
onRangeInput ( e ) {
18
30
this . inputTarget . value = e . currentTarget . value ;
19
31
}
Original file line number Diff line number Diff line change 16
16
< input
17
17
type ="text "
18
18
class ="form-control "
19
- data-action ="input->inputs-range-group-v-2#onInputInput <%= actions %> "
19
+ data-action ="input->inputs-range-group-v-2#onInputInput focusin->inputs-range-group-v-2#onInputFocusIn blur->inputs-range-group-v-2#onInputBlur <%= actions %> "
20
20
data-inputs-range-group-v-2-target ="input "
21
21
value ="<%= value %> "
22
22
>
23
- < span class ="inputs-range-group-v-2-unit fw-semibold ">
23
+ < span
24
+ class ="inputs-range-group-v-2-unit fw-semibold "
25
+ data-inputs-range-group-v-2-target ="unit "
26
+ data-action ="click->inputs-range-group-v-2#onUnitClick "
27
+ >
24
28
< %= input_unit %>
25
29
</ span >
26
30
</ div >
You can’t perform that action at this time.
0 commit comments