Skip to content

Commit 37a6017

Browse files
authored
Merge pull request #5719 from IgniteUI/fix-fluent-calendar
fix(calendar): Make the fluent calendar to work with the new range selection
2 parents f8f50a3 + b939cbe commit 37a6017

File tree

4 files changed

+58
-18
lines changed

4 files changed

+58
-18
lines changed

projects/igniteui-angular/src/lib/core/styles/components/calendar/_calendar-component.scss

+4
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,10 @@
6464
@extend %cal-value--current !optional;
6565
}
6666

67+
@include e(date, $mods: ('selected', 'current')) {
68+
@extend %cal-value--current--selected !optional;
69+
}
70+
6771
@include e(date, 'weekend') {
6872
@extend %cal-value !optional;
6973
@extend %cal-value--weekend !optional;

projects/igniteui-angular/src/lib/core/styles/components/calendar/_calendar-theme.scss

+44-16
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,17 @@
295295
$cal-row-margin: em(2px) 0;
296296
$selected-hover-color: text-contrast(map-get($theme, 'date-selected-background'));
297297

298+
$current-color-variant: map-get((
299+
material: --var($theme, 'date-selected-background'),
300+
fluent:--var($theme, 'date-current-bg-color')
301+
), map-get($theme, variant));
302+
303+
$current-text-color-variant: map-get((
304+
material: --var($theme, 'date-selected-text-color'),
305+
fluent:--var($theme, 'date-current-text-color')
306+
), map-get($theme, variant));
307+
308+
298309
%cal-display {
299310
display: flex;
300311
flex-flow: column nowrap;
@@ -361,7 +372,7 @@
361372
}
362373

363374
[dir='rtl'] & {
364-
transform: scaleX(-1);
375+
transform: scaleX(-1)
365376
}
366377
}
367378

@@ -418,10 +429,10 @@
418429
justify-content: center;
419430
align-items: center;
420431
flex-grow: 1;
432+
flex-basis: 14.28%;
421433
color: --var($theme, 'content-text-color');
422434
cursor: pointer;
423435
outline: none;
424-
flex-basis: 14.28%;
425436
// transition: background .15s ease-out;
426437

427438
&:hover,
@@ -518,20 +529,6 @@
518529
color: --var($theme, 'inactive-text-color');
519530
}
520531

521-
%cal-value--current {
522-
color: --var($theme, 'date-current-text-color');
523-
background: --var($theme, 'date-current-bg-color')!important;
524-
font-weight: $cal-value-fw !important;
525-
526-
&:hover {
527-
background: --var($theme, 'date-current-bg-color')!important;
528-
}
529-
530-
&:focus {
531-
background: --var($theme, 'date-current-bg-color')!important;
532-
}
533-
}
534-
535532
%cal-value--special {
536533
%cal-value-content {
537534
background: --var($theme, 'date-special-background');
@@ -550,6 +547,37 @@
550547
}
551548
}
552549

550+
%cal-value--current {
551+
%cal-value-content {
552+
color: --var($theme, 'date-current-text-color');
553+
font-weight: $cal-value-fw ;
554+
background: --var($theme, 'date-current-bg-color');
555+
556+
&:hover {
557+
background: --var($theme, 'date-current-bg-color');
558+
}
559+
560+
&:focus {
561+
background: --var($theme, 'date-current-bg-color');
562+
}
563+
}
564+
}
565+
566+
%cal-value--current--selected {
567+
%cal-value-content {
568+
color: $current-text-color-variant;
569+
background: $current-color-variant;
570+
571+
&:hover {
572+
background: $current-color-variant;
573+
}
574+
575+
&:focus {
576+
background: $current-color-variant;
577+
}
578+
}
579+
}
580+
553581
%cal-value--disabled {
554582
pointer-events: none;
555583
cursor: not-allowed;

projects/igniteui-angular/src/lib/core/styles/components/date-picker/_date-picker-theme.scss

+1
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848

4949
%cal-value {
5050
color: --var($theme, 'content-text-color');
51+
flex-basis: 14.28%;
5152
}
5253

5354
%cal-value--label {

projects/igniteui-angular/src/lib/core/styles/themes/schemas/light/_calendar.scss

+9-2
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
$_light-calendar: extend(
4242
$_default-shape-calendar,
4343
(
44+
variant: 'material',
4445
content-background: (
4546
igx-color: 'surface'
4647
),
@@ -125,8 +126,13 @@ $_light-calendar: extend(
125126
),
126127

127128
date-current-bg-color: transparent,
128-
date-current-bg-hover-color: transparent,
129-
date-current-bg-focus-color: transparent,
129+
130+
date-current-bg-hover-color: (
131+
igx-contrast-color: ('secondary', 500)
132+
),
133+
date-current-bg-focus-color: (
134+
igx-contrast-color: ('secondary', 500)
135+
),
130136

131137
date-hover-background: (
132138
igx-color: ('grays', 200)
@@ -170,6 +176,7 @@ $_fluent-calendar: extend(
170176
$_light-calendar,
171177
$_fluent-shape-calendar,
172178
(
179+
variant: 'fluent',
173180
date-current-text-color: #fff,
174181

175182
date-current-bg-color: (

0 commit comments

Comments
 (0)