File tree Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -34,6 +34,7 @@ const EVENT_MOUSELEAVE = `mouseleave${EVENT_KEY}`
34
34
35
35
const CLASS_NAME_ACTIVE = 'active'
36
36
const CLASS_NAME_DISABLED = 'disabled'
37
+ const CLASS_NAME_READONLY = 'readonly'
37
38
const CLASS_NAME_RATING = 'rating'
38
39
const CLASS_NAME_RATING_ITEM = 'rating-item'
39
40
const CLASS_NAME_RATING_ITEM_ICON = 'rating-item-icon'
@@ -355,6 +356,10 @@ class Rating extends BaseComponent {
355
356
this . _element . classList . add ( CLASS_NAME_DISABLED )
356
357
}
357
358
359
+ if ( this . _config . readOnly ) {
360
+ this . _element . classList . add ( CLASS_NAME_READONLY )
361
+ }
362
+
358
363
this . _element . setAttribute ( 'role' , 'radiogroup' )
359
364
Array . from ( { length : this . _config . itemCount } , ( _ , index ) => this . _createRatingItem ( index ) )
360
365
}
Original file line number Diff line number Diff line change 18
18
19
19
& :not (.disabled ):not (.readonly ) {
20
20
.rating-item {
21
- cursor : pointer ;
21
+ .rating-item-label {
22
+ cursor : pointer ;
23
+ }
22
24
23
25
& :hover {
24
26
transform : var (--#{$prefix}rating-item-scale-transform );
47
49
font-size : var (--#{$prefix}rating-item-height );
48
50
line-height : 0 ;
49
51
color : var (--#{$prefix}rating-item-color );
50
- cursor : pointer ;
52
+ cursor : default ; // has cursor pointer only if the rating is not disabled or readonly (see above)
51
53
52
54
* {
53
55
pointer-events : none ;
83
85
.rating-item-icon {
84
86
width : var (--#{$prefix}rating-item-height );
85
87
height : var (--#{$prefix}rating-item-height );
86
- cursor : pointer ;
88
+ // cursor: pointer; // has the cursor of rating-item-label (parent)
87
89
background-color : var (--#{$prefix}rating-item-color );
88
90
mask : var (--#{$prefix}rating-item-icon ) center / var (--#{$prefix}rating-item-height ) no-repeat ;
89
91
}
You can’t perform that action at this time.
0 commit comments