11$mat-calendar-body-label-padding-start : 5% !default ;
2- $mat-calendar-body-label-translation : -6px !default ;
2+ // We don't want the label to jump around when we switch between month and year views, so we use
3+ // the same amount of padding regardless of the number of columns. We align the header label with
4+ // the one third mark of the first cell, this was chosen somewhat arbitrarily to make it look
5+ // roughly like the mock. Half way is too far since the cell text is center aligned.
6+ $mat-calendar-body-label-side-padding : 33% / 7 !default ;
37$mat-calendar-body-cell-min-size : 32px !default ;
4- $mat-calendar-body-cell-size : 100% / 7 !default ;
58$mat-calendar-body-cell-content-margin : 5% !default ;
69$mat-calendar-body-cell-content-border-width : 1px !default ;
710
811$mat-calendar-body-min-size : 7 * $mat-calendar-body-cell-min-size !default ;
9- $mat-calendar-body-cell-padding : $mat-calendar-body-cell-size / 2 !default ;
1012$mat-calendar-body-cell-content-size : 100% - $mat-calendar-body-cell-content-margin * 2 !default ;
1113
1214
@@ -15,20 +17,17 @@ $mat-calendar-body-cell-content-size: 100% - $mat-calendar-body-cell-content-mar
1517}
1618
1719.mat-calendar-body-label {
18- padding : $mat-calendar-body-cell-padding 0
19- $mat-calendar-body-cell-padding $mat-calendar-body-cell-padding ;
2020 height : 0 ;
2121 line-height : 0 ;
22- transform : translateX ($mat-calendar-body-label-translation );
2322 text-align : left ;
23+ padding-left : $mat-calendar-body-label-side-padding ;
24+ padding-right : $mat-calendar-body-label-side-padding ;
2425}
2526
2627.mat-calendar-body-cell {
2728 position : relative ;
28- width : $mat-calendar-body-cell-size ;
2929 height : 0 ;
3030 line-height : 0 ;
31- padding : $mat-calendar-body-cell-padding 0 ;
3231 text-align : center ;
3332 outline : none ;
3433 cursor : pointer ;
@@ -53,13 +52,13 @@ $mat-calendar-body-cell-content-size: 100% - $mat-calendar-body-cell-content-mar
5352
5453 border-width : $mat-calendar-body-cell-content-border-width ;
5554 border-style : solid ;
56- border-radius : 50% ;
55+
56+ // Choosing a value clearly larger than the height ensures we get the correct capsule shape.
57+ border-radius : 999px ;
5758}
5859
5960[dir = ' rtl' ] {
6061 .mat-calendar-body-label {
61- padding : 0 $mat-calendar-body-cell-padding 0 0 ;
62- transform : translateX (- $mat-calendar-body-label-translation );
6362 text-align : right ;
6463 }
6564}
0 commit comments