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}`
3434
3535const CLASS_NAME_ACTIVE = 'active'
3636const CLASS_NAME_DISABLED = 'disabled'
37+ const CLASS_NAME_READONLY = 'readonly'
3738const CLASS_NAME_RATING = 'rating'
3839const CLASS_NAME_RATING_ITEM = 'rating-item'
3940const CLASS_NAME_RATING_ITEM_ICON = 'rating-item-icon'
@@ -355,6 +356,10 @@ class Rating extends BaseComponent {
355356 this . _element . classList . add ( CLASS_NAME_DISABLED )
356357 }
357358
359+ if ( this . _config . readOnly ) {
360+ this . _element . classList . add ( CLASS_NAME_READONLY )
361+ }
362+
358363 this . _element . setAttribute ( 'role' , 'radiogroup' )
359364 Array . from ( { length : this . _config . itemCount } , ( _ , index ) => this . _createRatingItem ( index ) )
360365 }
Original file line number Diff line number Diff line change 1818
1919 & :not (.disabled ):not (.readonly ) {
2020 .rating-item {
21- cursor : pointer ;
21+ .rating-item-label {
22+ cursor : pointer ;
23+ }
2224
2325 & :hover {
2426 transform : var (--#{$prefix}rating-item-scale-transform );
4749 font-size : var (--#{$prefix}rating-item-height );
4850 line-height : 0 ;
4951 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)
5153
5254 * {
5355 pointer-events : none ;
8385.rating-item-icon {
8486 width : var (--#{$prefix}rating-item-height );
8587 height : var (--#{$prefix}rating-item-height );
86- cursor : pointer ;
88+ // cursor: pointer; // has the cursor of rating-item-label (parent)
8789 background-color : var (--#{$prefix}rating-item-color );
8890 mask : var (--#{$prefix}rating-item-icon ) center / var (--#{$prefix}rating-item-height ) no-repeat ;
8991}
You can’t perform that action at this time.
0 commit comments