@@ -13,12 +13,30 @@ import {
1313 ElementRef ,
1414 ChangeDetectorRef ,
1515 ChangeDetectionStrategy ,
16+ inject ,
17+ DestroyRef ,
18+ AfterContentChecked
1619} from '@angular/core' ;
1720import { NG_VALUE_ACCESSOR } from '@angular/forms' ;
1821import { TitleCasePipe } from '@angular/common' ;
1922import { CalendarSelection , ScrollDirection } from '../../calendar/calendar' ;
2023import { IgxDayItemComponent } from './day-item.component' ;
21- import { CalendarDay , DateRangeType , PlatformUtil , areSameMonth , generateMonth , getClosestActiveDate , getNextActiveDate , getPreviousActiveDate , intoChunks , isDateInRanges } from 'igniteui-angular/core' ;
24+ import {
25+ CalendarDay ,
26+ DateRangeType ,
27+ PlatformUtil ,
28+ areSameMonth ,
29+ generateMonth ,
30+ getClosestActiveDate ,
31+ getNextActiveDate ,
32+ getPreviousActiveDate ,
33+ intoChunks ,
34+ isDateInRanges ,
35+ getComponentTheme ,
36+ IgxTheme ,
37+ THEME_TOKEN ,
38+ ThemeToken
39+ } from 'igniteui-angular/core' ;
2240import { IgxCalendarBaseDirective } from '../calendar-base' ;
2341import { IViewChangingEventArgs } from './days-view.interface' ;
2442
@@ -37,7 +55,7 @@ let NEXT_ID = 0;
3755 changeDetection : ChangeDetectionStrategy . OnPush ,
3856 imports : [ IgxDayItemComponent , TitleCasePipe ]
3957} )
40- export class IgxDaysViewComponent extends IgxCalendarBaseDirective {
58+ export class IgxDaysViewComponent extends IgxCalendarBaseDirective implements AfterContentChecked {
4159 #standalone = true ;
4260
4361 /**
@@ -187,6 +205,33 @@ export class IgxDaysViewComponent extends IgxCalendarBaseDirective {
187205 private _hideTrailingDays : boolean ;
188206 private _showActiveDay : boolean ;
189207
208+ private _destroyRef = inject ( DestroyRef ) ;
209+ private _theme : IgxTheme ;
210+
211+ @HostBinding ( 'class.igx-days-view' )
212+ public defaultClass = true ;
213+
214+ // Theme-specific classes
215+ @HostBinding ( 'class.igx-days-view--material' )
216+ protected get isMaterial ( ) : boolean {
217+ return this . _theme === 'material' ;
218+ }
219+
220+ @HostBinding ( 'class.igx-days-view--fluent' )
221+ protected get isFluent ( ) : boolean {
222+ return this . _theme === 'fluent' ;
223+ }
224+
225+ @HostBinding ( 'class.igx-days-view--bootstrap' )
226+ protected get isBootstrap ( ) : boolean {
227+ return this . _theme === 'bootstrap' ;
228+ }
229+
230+ @HostBinding ( 'class.igx-days-view--indigo' )
231+ protected get isIndigo ( ) : boolean {
232+ return this . _theme === 'indigo' ;
233+ }
234+
190235 /**
191236 * @hidden
192237 */
@@ -195,8 +240,37 @@ export class IgxDaysViewComponent extends IgxCalendarBaseDirective {
195240 @Inject ( LOCALE_ID ) _localeId : string ,
196241 protected el : ElementRef ,
197242 public override cdr : ChangeDetectorRef ,
243+ @Inject ( THEME_TOKEN ) private themeToken : ThemeToken
244+
198245 ) {
199246 super ( platform , _localeId , null , cdr ) ;
247+
248+ this . _theme = this . themeToken . theme ;
249+
250+ const themeChange = this . themeToken . onChange ( ( theme ) => {
251+ if ( this . _theme !== theme ) {
252+ this . _theme = theme ;
253+ this . cdr . detectChanges ( ) ;
254+ }
255+ } ) ;
256+
257+ this . _destroyRef . onDestroy ( ( ) => themeChange . unsubscribe ( ) ) ;
258+ }
259+
260+ private setComponentTheme ( ) {
261+ // allow DOM theme override (same pattern as input-group)
262+ if ( ! this . themeToken . preferToken ) {
263+ const theme = getComponentTheme ( this . el . nativeElement ) ;
264+
265+ if ( theme && theme !== this . _theme ) {
266+ this . _theme = theme ;
267+ this . cdr . markForCheck ( ) ;
268+ }
269+ }
270+ }
271+
272+ public ngAfterContentChecked ( ) {
273+ this . setComponentTheme ( ) ;
200274 }
201275
202276 /**
0 commit comments