@spartan-ng/brain 1.3.4 → 1.4.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -69,7 +69,7 @@ import { BrnSelectImports } from '@spartan-ng/brain/select';
69
69
 
70
70
  Available entry points:
71
71
 
72
- `accordion`, `alert-dialog`, `autocomplete`, `avatar`, `button`, `calendar`, `checkbox`, `collapsible`, `combobox`, `command`, `core`, `date-time`, `date-time-luxon`, `dialog`, `field`, `forms`, `hover-card`, `input`, `input-otp`, `label`, `navigation-menu`, `popover`, `progress`, `radio-group`, `resizable`, `select`, `separator`, `sheet`, `slider`, `sonner`, `switch`, `tabs`, `textarea`, `toggle`, `toggle-group`, `tooltip`.
72
+ `accordion`, `alert-dialog`, `autocomplete`, `avatar`, `button`, `calendar`, `checkbox`, `collapsible`, `combobox`, `command`, `core`, `date-time`, `date-time-luxon`, `dialog`, `field`, `forms`, `hover-card`, `input`, `input-otp`, `label`, `navigation-menu`, `popover`, `progress`, `questionnaire`, `radio-group`, `resizable`, `select`, `separator`, `sheet`, `slider`, `sonner`, `switch`, `tabs`, `textarea`, `toggle`, `toggle-group`, `tooltip`.
73
73
 
74
74
  Browse the [components gallery](https://www.spartan.ng/components) for live demos, API docs, and styled helm examples for each primitive.
75
75
 
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { input, Directive, InjectionToken, inject, signal, Injectable, ChangeDetectorRef, Injector, booleanAttribute, model, numberAttribute, computed, contentChild, linkedSignal, afterNextRender, DestroyRef, ElementRef, effect, ViewContainerRef, TemplateRef, untracked } from '@angular/core';
2
+ import { input, Directive, InjectionToken, inject, signal, Injectable, ChangeDetectorRef, Injector, booleanAttribute, model, numberAttribute, computed, contentChild, linkedSignal, output, afterNextRender, DestroyRef, ElementRef, effect, ViewContainerRef, TemplateRef, untracked } from '@angular/core';
3
3
  import { injectDateAdapter } from '@spartan-ng/brain/date-time';
4
4
  import { outputToObservable, takeUntilDestroyed } from '@angular/core/rxjs-interop';
5
5
  import { BrnSelect } from '@spartan-ng/brain/select';
@@ -141,6 +141,12 @@ class BrnCalendar {
141
141
  * The focused date.
142
142
  */
143
143
  focusedDate = linkedSignal(() => this.constrainDate(this.defaultFocusedDate() ?? this.date() ?? this._dateAdapter.now()), ...(ngDevMode ? [{ debugName: "focusedDate" }] : /* istanbul ignore next */ []));
144
+ /** Emits whenever the focused date changes. */
145
+ focusedDateChange = output();
146
+ _setFocusedDate(date) {
147
+ this.focusedDate.set(date);
148
+ this.focusedDateChange.emit(date);
149
+ }
144
150
  /**
145
151
  * Get all the days to display, this is the days of the current month
146
152
  * and the days of the previous and next month to fill the grid.
@@ -220,7 +226,7 @@ class BrnCalendar {
220
226
  else {
221
227
  this.date.set(date);
222
228
  }
223
- this.focusedDate.set(date);
229
+ this._setFocusedDate(date);
224
230
  }
225
231
  /** @internal Set the focused date */
226
232
  setFocusedDate(date) {
@@ -228,7 +234,7 @@ class BrnCalendar {
228
234
  if (this.isDateDisabled(date)) {
229
235
  return;
230
236
  }
231
- this.focusedDate.set(date);
237
+ this._setFocusedDate(date);
232
238
  // wait until the cells have all updated
233
239
  afterNextRender({
234
240
  write: () => {
@@ -280,7 +286,7 @@ class BrnCalendar {
280
286
  this._cells.push(cell);
281
287
  }
282
288
  /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.16", ngImport: i0, type: BrnCalendar, deps: [], target: i0.ɵɵFactoryTarget.Directive });
283
- /** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "21.2.16", type: BrnCalendar, isStandalone: true, selector: "[brnCalendar]", inputs: { highlightDays: { classPropertyName: "highlightDays", publicName: "highlightDays", isSignal: true, isRequired: false, transformFunction: null }, min: { classPropertyName: "min", publicName: "min", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, date: { classPropertyName: "date", publicName: "date", isSignal: true, isRequired: false, transformFunction: null }, dateDisabled: { classPropertyName: "dateDisabled", publicName: "dateDisabled", isSignal: true, isRequired: false, transformFunction: null }, weekStartsOn: { classPropertyName: "weekStartsOn", publicName: "weekStartsOn", isSignal: true, isRequired: false, transformFunction: null }, defaultFocusedDate: { classPropertyName: "defaultFocusedDate", publicName: "defaultFocusedDate", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { date: "dateChange" }, providers: [provideBrnCalendar(BrnCalendar)], queries: [{ propertyName: "header", first: true, predicate: BrnCalendarHeader, descendants: true, isSignal: true }], ngImport: i0 });
289
+ /** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "21.2.16", type: BrnCalendar, isStandalone: true, selector: "[brnCalendar]", inputs: { highlightDays: { classPropertyName: "highlightDays", publicName: "highlightDays", isSignal: true, isRequired: false, transformFunction: null }, min: { classPropertyName: "min", publicName: "min", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, date: { classPropertyName: "date", publicName: "date", isSignal: true, isRequired: false, transformFunction: null }, dateDisabled: { classPropertyName: "dateDisabled", publicName: "dateDisabled", isSignal: true, isRequired: false, transformFunction: null }, weekStartsOn: { classPropertyName: "weekStartsOn", publicName: "weekStartsOn", isSignal: true, isRequired: false, transformFunction: null }, defaultFocusedDate: { classPropertyName: "defaultFocusedDate", publicName: "defaultFocusedDate", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { date: "dateChange", focusedDateChange: "focusedDateChange" }, providers: [provideBrnCalendar(BrnCalendar)], queries: [{ propertyName: "header", first: true, predicate: BrnCalendarHeader, descendants: true, isSignal: true }], ngImport: i0 });
284
290
  }
285
291
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.16", ngImport: i0, type: BrnCalendar, decorators: [{
286
292
  type: Directive,
@@ -288,7 +294,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.16", ngImpo
288
294
  selector: '[brnCalendar]',
289
295
  providers: [provideBrnCalendar(BrnCalendar)],
290
296
  }]
291
- }], propDecorators: { highlightDays: [{ type: i0.Input, args: [{ isSignal: true, alias: "highlightDays", required: false }] }], min: [{ type: i0.Input, args: [{ isSignal: true, alias: "min", required: false }] }], max: [{ type: i0.Input, args: [{ isSignal: true, alias: "max", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], date: [{ type: i0.Input, args: [{ isSignal: true, alias: "date", required: false }] }, { type: i0.Output, args: ["dateChange"] }], dateDisabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "dateDisabled", required: false }] }], weekStartsOn: [{ type: i0.Input, args: [{ isSignal: true, alias: "weekStartsOn", required: false }] }], defaultFocusedDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "defaultFocusedDate", required: false }] }], header: [{ type: i0.ContentChild, args: [i0.forwardRef(() => BrnCalendarHeader), { isSignal: true }] }] } });
297
+ }], propDecorators: { highlightDays: [{ type: i0.Input, args: [{ isSignal: true, alias: "highlightDays", required: false }] }], min: [{ type: i0.Input, args: [{ isSignal: true, alias: "min", required: false }] }], max: [{ type: i0.Input, args: [{ isSignal: true, alias: "max", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], date: [{ type: i0.Input, args: [{ isSignal: true, alias: "date", required: false }] }, { type: i0.Output, args: ["dateChange"] }], dateDisabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "dateDisabled", required: false }] }], weekStartsOn: [{ type: i0.Input, args: [{ isSignal: true, alias: "weekStartsOn", required: false }] }], defaultFocusedDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "defaultFocusedDate", required: false }] }], header: [{ type: i0.ContentChild, args: [i0.forwardRef(() => BrnCalendarHeader), { isSignal: true }] }], focusedDateChange: [{ type: i0.Output, args: ["focusedDateChange"] }] } });
292
298
 
293
299
  class BrnCalendarCell {
294
300
  /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.16", ngImport: i0, type: BrnCalendarCell, deps: [], target: i0.ɵɵFactoryTarget.Directive });
@@ -520,7 +526,7 @@ class BrnCalendarMonthSelect {
520
526
  .months()
521
527
  .findIndex((month) => month === selectedMonth);
522
528
  const targetDate = this._dateAdapter.set(this._calendar.focusedDate(), { month });
523
- this._calendar.focusedDate.set(targetDate);
529
+ this._calendar.setFocusedDate(targetDate);
524
530
  }
525
531
  /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.16", ngImport: i0, type: BrnCalendarMonthSelect, deps: [], target: i0.ɵɵFactoryTarget.Directive });
526
532
  /** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.16", type: BrnCalendarMonthSelect, isStandalone: true, selector: "brnSelect[brnCalendarMonthSelect],hlm-select[brnCalendarMonthSelect]", ngImport: i0 });
@@ -539,8 +545,27 @@ class BrnCalendarNextButton {
539
545
  _dateAdapter = injectDateAdapter();
540
546
  /** Access the calendar i18n */
541
547
  _i18n = injectBrnCalendarI18n();
548
+ /** Whether navigating to the next month is disabled. */
549
+ _disabled = computed(() => {
550
+ const { targetDate, possibleDate } = this.nextMonthTarget();
551
+ const effective = this._dateAdapter.isSameMonth(possibleDate, targetDate) ? possibleDate : targetDate;
552
+ return this._calendar.isDateDisabled(effective);
553
+ }, ...(ngDevMode ? [{ debugName: "_disabled" }] : /* istanbul ignore next */ []));
542
554
  /** Focus the next month */
543
555
  focusNextMonth() {
556
+ if (this._disabled()) {
557
+ return;
558
+ }
559
+ const { targetDate, possibleDate } = this.nextMonthTarget();
560
+ if (this._dateAdapter.isSameMonth(possibleDate, targetDate)) {
561
+ // if this date is within the same month, then focus it
562
+ this._calendar.setFocusedDate(possibleDate);
563
+ return;
564
+ }
565
+ this._calendar.setFocusedDate(targetDate);
566
+ }
567
+ /** @internal The target date in the next month and its constrained counterpart. */
568
+ nextMonthTarget() {
544
569
  const focusedDate = this._calendar.focusedDate();
545
570
  const date = this._dateAdapter.getDate(focusedDate);
546
571
  // go to start of month first, then add 1 month to avoid day overflow
@@ -556,25 +581,21 @@ class BrnCalendarNextButton {
556
581
  targetDate = this._dateAdapter.set(nextMonthTarget, { day: date });
557
582
  }
558
583
  // if the date is disabled, but there are available dates in the month, focus the constrained date.
559
- const possibleDate = this._calendar.constrainDate(targetDate);
560
- if (this._dateAdapter.isSameMonth(possibleDate, targetDate)) {
561
- // if this date is within the same month, then focus it
562
- this._calendar.focusedDate.set(possibleDate);
563
- return;
564
- }
565
- this._calendar.focusedDate.set(targetDate);
584
+ return { targetDate, possibleDate: this._calendar.constrainDate(targetDate) };
566
585
  }
567
586
  /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.16", ngImport: i0, type: BrnCalendarNextButton, deps: [], target: i0.ɵɵFactoryTarget.Directive });
568
- /** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.16", type: BrnCalendarNextButton, isStandalone: true, selector: "[brnCalendarNextButton]", host: { attributes: { "type": "button", "data-slot": "calendar-next-button" }, listeners: { "click": "focusNextMonth()" }, properties: { "attr.aria-label": "_i18n.config().labelNext()" } }, ngImport: i0 });
587
+ /** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.16", type: BrnCalendarNextButton, isStandalone: true, selector: "button[brnCalendarNextButton]", host: { attributes: { "type": "button", "data-slot": "calendar-next-button" }, listeners: { "click": "focusNextMonth()" }, properties: { "attr.aria-label": "_i18n.config().labelNext()", "attr.aria-disabled": "_disabled() ? true : null", "disabled": "_disabled()" } }, ngImport: i0 });
569
588
  }
570
589
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.16", ngImport: i0, type: BrnCalendarNextButton, decorators: [{
571
590
  type: Directive,
572
591
  args: [{
573
- selector: '[brnCalendarNextButton]',
592
+ selector: 'button[brnCalendarNextButton]',
574
593
  host: {
575
594
  type: 'button',
576
595
  'data-slot': 'calendar-next-button',
577
596
  '[attr.aria-label]': '_i18n.config().labelNext()',
597
+ '[attr.aria-disabled]': '_disabled() ? true : null',
598
+ '[disabled]': '_disabled()',
578
599
  '(click)': 'focusNextMonth()',
579
600
  },
580
601
  }]
@@ -587,8 +608,27 @@ class BrnCalendarPreviousButton {
587
608
  _dateAdapter = injectDateAdapter();
588
609
  /** Access the calendar i18n */
589
610
  _i18n = injectBrnCalendarI18n();
611
+ /** Whether navigating to the previous month is disabled. */
612
+ _disabled = computed(() => {
613
+ const { targetDate, possibleDate } = this.previousMonthTarget();
614
+ const effective = this._dateAdapter.isSameMonth(possibleDate, targetDate) ? possibleDate : targetDate;
615
+ return this._calendar.isDateDisabled(effective);
616
+ }, ...(ngDevMode ? [{ debugName: "_disabled" }] : /* istanbul ignore next */ []));
590
617
  /** Focus the previous month */
591
618
  focusPreviousMonth() {
619
+ if (this._disabled()) {
620
+ return;
621
+ }
622
+ const { targetDate, possibleDate } = this.previousMonthTarget();
623
+ if (this._dateAdapter.isSameMonth(possibleDate, targetDate)) {
624
+ // if this date is within the same month, then focus it
625
+ this._calendar.setFocusedDate(possibleDate);
626
+ return;
627
+ }
628
+ this._calendar.setFocusedDate(targetDate);
629
+ }
630
+ /** @internal The target date in the previous month and its constrained counterpart. */
631
+ previousMonthTarget() {
592
632
  const focusedDate = this._calendar.focusedDate();
593
633
  const date = this._dateAdapter.getDate(focusedDate);
594
634
  // go to start of month first, then subtract 1 month to avoid day overflow
@@ -604,25 +644,21 @@ class BrnCalendarPreviousButton {
604
644
  targetDate = this._dateAdapter.set(previousMonthTarget, { day: date });
605
645
  }
606
646
  // if the date is disabled, but there are available dates in the month, focus the constrained date.
607
- const possibleDate = this._calendar.constrainDate(targetDate);
608
- if (this._dateAdapter.isSameMonth(possibleDate, targetDate)) {
609
- // if this date is within the same month, then focus it
610
- this._calendar.focusedDate.set(possibleDate);
611
- return;
612
- }
613
- this._calendar.focusedDate.set(targetDate);
647
+ return { targetDate, possibleDate: this._calendar.constrainDate(targetDate) };
614
648
  }
615
649
  /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.16", ngImport: i0, type: BrnCalendarPreviousButton, deps: [], target: i0.ɵɵFactoryTarget.Directive });
616
- /** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.16", type: BrnCalendarPreviousButton, isStandalone: true, selector: "[brnCalendarPreviousButton]", host: { attributes: { "type": "button", "data-slot": "calendar-previous-button" }, listeners: { "click": "focusPreviousMonth()" }, properties: { "attr.aria-label": "_i18n.config().labelPrevious()" } }, ngImport: i0 });
650
+ /** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.16", type: BrnCalendarPreviousButton, isStandalone: true, selector: "button[brnCalendarPreviousButton]", host: { attributes: { "type": "button", "data-slot": "calendar-previous-button" }, listeners: { "click": "focusPreviousMonth()" }, properties: { "attr.aria-label": "_i18n.config().labelPrevious()", "attr.aria-disabled": "_disabled() ? true : null", "disabled": "_disabled()" } }, ngImport: i0 });
617
651
  }
618
652
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.16", ngImport: i0, type: BrnCalendarPreviousButton, decorators: [{
619
653
  type: Directive,
620
654
  args: [{
621
- selector: '[brnCalendarPreviousButton]',
655
+ selector: 'button[brnCalendarPreviousButton]',
622
656
  host: {
623
657
  type: 'button',
624
658
  'data-slot': 'calendar-previous-button',
625
659
  '[attr.aria-label]': '_i18n.config().labelPrevious()',
660
+ '[attr.aria-disabled]': '_disabled() ? true : null',
661
+ '[disabled]': '_disabled()',
626
662
  '(click)': 'focusPreviousMonth()',
627
663
  },
628
664
  }]
@@ -778,7 +814,7 @@ class BrnCalendarYearSelect {
778
814
  /** Focus selected year */
779
815
  yearSelected(year) {
780
816
  const targetDate = this._dateAdapter.set(this._calendar.focusedDate(), { year });
781
- this._calendar.focusedDate.set(targetDate);
817
+ this._calendar.setFocusedDate(targetDate);
782
818
  }
783
819
  /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.16", ngImport: i0, type: BrnCalendarYearSelect, deps: [], target: i0.ɵɵFactoryTarget.Directive });
784
820
  /** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.16", type: BrnCalendarYearSelect, isStandalone: true, selector: "brnSelect[brnCalendarYearSelect],hlm-select[brnCalendarYearSelect]", ngImport: i0 });
@@ -853,6 +889,12 @@ class BrnCalendarMulti {
853
889
  * The focused date.
854
890
  */
855
891
  focusedDate = linkedSignal(() => this.constrainDate(this.defaultFocusedDate() ?? this._dateAdapter.now()), ...(ngDevMode ? [{ debugName: "focusedDate" }] : /* istanbul ignore next */ []));
892
+ /** Emits whenever the focused date changes. */
893
+ focusedDateChange = output();
894
+ _setFocusedDate(date) {
895
+ this.focusedDate.set(date);
896
+ this.focusedDateChange.emit(date);
897
+ }
856
898
  /**
857
899
  * Get all the days to display, this is the days of the current month
858
900
  * and the days of the previous and next month to fill the grid.
@@ -953,7 +995,7 @@ class BrnCalendarMulti {
953
995
  if (this.isDateDisabled(date)) {
954
996
  return;
955
997
  }
956
- this.focusedDate.set(date);
998
+ this._setFocusedDate(date);
957
999
  // wait until the cells have all updated
958
1000
  afterNextRender({
959
1001
  write: () => {
@@ -978,7 +1020,7 @@ class BrnCalendarMulti {
978
1020
  this._cells.push(cell);
979
1021
  }
980
1022
  /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.16", ngImport: i0, type: BrnCalendarMulti, deps: [], target: i0.ɵɵFactoryTarget.Directive });
981
- /** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "21.2.16", type: BrnCalendarMulti, isStandalone: true, selector: "[brnCalendarMulti]", inputs: { highlightDays: { classPropertyName: "highlightDays", publicName: "highlightDays", isSignal: true, isRequired: false, transformFunction: null }, min: { classPropertyName: "min", publicName: "min", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, minSelection: { classPropertyName: "minSelection", publicName: "minSelection", isSignal: true, isRequired: false, transformFunction: null }, maxSelection: { classPropertyName: "maxSelection", publicName: "maxSelection", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, date: { classPropertyName: "date", publicName: "date", isSignal: true, isRequired: false, transformFunction: null }, dateDisabled: { classPropertyName: "dateDisabled", publicName: "dateDisabled", isSignal: true, isRequired: false, transformFunction: null }, weekStartsOn: { classPropertyName: "weekStartsOn", publicName: "weekStartsOn", isSignal: true, isRequired: false, transformFunction: null }, defaultFocusedDate: { classPropertyName: "defaultFocusedDate", publicName: "defaultFocusedDate", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { date: "dateChange" }, providers: [provideBrnCalendar(BrnCalendarMulti)], queries: [{ propertyName: "header", first: true, predicate: BrnCalendarHeader, descendants: true, isSignal: true }], ngImport: i0 });
1023
+ /** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "21.2.16", type: BrnCalendarMulti, isStandalone: true, selector: "[brnCalendarMulti]", inputs: { highlightDays: { classPropertyName: "highlightDays", publicName: "highlightDays", isSignal: true, isRequired: false, transformFunction: null }, min: { classPropertyName: "min", publicName: "min", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, minSelection: { classPropertyName: "minSelection", publicName: "minSelection", isSignal: true, isRequired: false, transformFunction: null }, maxSelection: { classPropertyName: "maxSelection", publicName: "maxSelection", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, date: { classPropertyName: "date", publicName: "date", isSignal: true, isRequired: false, transformFunction: null }, dateDisabled: { classPropertyName: "dateDisabled", publicName: "dateDisabled", isSignal: true, isRequired: false, transformFunction: null }, weekStartsOn: { classPropertyName: "weekStartsOn", publicName: "weekStartsOn", isSignal: true, isRequired: false, transformFunction: null }, defaultFocusedDate: { classPropertyName: "defaultFocusedDate", publicName: "defaultFocusedDate", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { date: "dateChange", focusedDateChange: "focusedDateChange" }, providers: [provideBrnCalendar(BrnCalendarMulti)], queries: [{ propertyName: "header", first: true, predicate: BrnCalendarHeader, descendants: true, isSignal: true }], ngImport: i0 });
982
1024
  }
983
1025
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.16", ngImport: i0, type: BrnCalendarMulti, decorators: [{
984
1026
  type: Directive,
@@ -986,7 +1028,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.16", ngImpo
986
1028
  selector: '[brnCalendarMulti]',
987
1029
  providers: [provideBrnCalendar(BrnCalendarMulti)],
988
1030
  }]
989
- }], propDecorators: { highlightDays: [{ type: i0.Input, args: [{ isSignal: true, alias: "highlightDays", required: false }] }], min: [{ type: i0.Input, args: [{ isSignal: true, alias: "min", required: false }] }], max: [{ type: i0.Input, args: [{ isSignal: true, alias: "max", required: false }] }], minSelection: [{ type: i0.Input, args: [{ isSignal: true, alias: "minSelection", required: false }] }], maxSelection: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxSelection", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], date: [{ type: i0.Input, args: [{ isSignal: true, alias: "date", required: false }] }, { type: i0.Output, args: ["dateChange"] }], dateDisabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "dateDisabled", required: false }] }], weekStartsOn: [{ type: i0.Input, args: [{ isSignal: true, alias: "weekStartsOn", required: false }] }], defaultFocusedDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "defaultFocusedDate", required: false }] }], header: [{ type: i0.ContentChild, args: [i0.forwardRef(() => BrnCalendarHeader), { isSignal: true }] }] } });
1031
+ }], propDecorators: { highlightDays: [{ type: i0.Input, args: [{ isSignal: true, alias: "highlightDays", required: false }] }], min: [{ type: i0.Input, args: [{ isSignal: true, alias: "min", required: false }] }], max: [{ type: i0.Input, args: [{ isSignal: true, alias: "max", required: false }] }], minSelection: [{ type: i0.Input, args: [{ isSignal: true, alias: "minSelection", required: false }] }], maxSelection: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxSelection", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], date: [{ type: i0.Input, args: [{ isSignal: true, alias: "date", required: false }] }, { type: i0.Output, args: ["dateChange"] }], dateDisabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "dateDisabled", required: false }] }], weekStartsOn: [{ type: i0.Input, args: [{ isSignal: true, alias: "weekStartsOn", required: false }] }], defaultFocusedDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "defaultFocusedDate", required: false }] }], header: [{ type: i0.ContentChild, args: [i0.forwardRef(() => BrnCalendarHeader), { isSignal: true }] }], focusedDateChange: [{ type: i0.Output, args: ["focusedDateChange"] }] } });
990
1032
 
991
1033
  class BrnCalendarRange {
992
1034
  _cells = [];
@@ -1018,6 +1060,12 @@ class BrnCalendarRange {
1018
1060
  * The focused date.
1019
1061
  */
1020
1062
  focusedDate = linkedSignal(() => this.constrainDate(this.defaultFocusedDate() ?? this.startDate() ?? this._dateAdapter.now()), ...(ngDevMode ? [{ debugName: "focusedDate" }] : /* istanbul ignore next */ []));
1063
+ /** Emits whenever the focused date changes. */
1064
+ focusedDateChange = output();
1065
+ _setFocusedDate(date) {
1066
+ this.focusedDate.set(date);
1067
+ this.focusedDateChange.emit(date);
1068
+ }
1021
1069
  /**
1022
1070
  * The selected start date
1023
1071
  */
@@ -1135,7 +1183,7 @@ class BrnCalendarRange {
1135
1183
  if (this.isDateDisabled(date)) {
1136
1184
  return;
1137
1185
  }
1138
- this.focusedDate.set(date);
1186
+ this._setFocusedDate(date);
1139
1187
  // wait until the cells have all updated
1140
1188
  afterNextRender({
1141
1189
  write: () => {
@@ -1197,7 +1245,7 @@ class BrnCalendarRange {
1197
1245
  this._cells.push(cell);
1198
1246
  }
1199
1247
  /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.16", ngImport: i0, type: BrnCalendarRange, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1200
- /** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "21.2.16", type: BrnCalendarRange, isStandalone: true, selector: "[brnCalendarRange]", inputs: { highlightDays: { classPropertyName: "highlightDays", publicName: "highlightDays", isSignal: true, isRequired: false, transformFunction: null }, min: { classPropertyName: "min", publicName: "min", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, dateDisabled: { classPropertyName: "dateDisabled", publicName: "dateDisabled", isSignal: true, isRequired: false, transformFunction: null }, weekStartsOn: { classPropertyName: "weekStartsOn", publicName: "weekStartsOn", isSignal: true, isRequired: false, transformFunction: null }, defaultFocusedDate: { classPropertyName: "defaultFocusedDate", publicName: "defaultFocusedDate", isSignal: true, isRequired: false, transformFunction: null }, startDate: { classPropertyName: "startDate", publicName: "startDate", isSignal: true, isRequired: false, transformFunction: null }, endDate: { classPropertyName: "endDate", publicName: "endDate", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { startDate: "startDateChange", endDate: "endDateChange" }, providers: [provideBrnCalendar(BrnCalendarRange)], queries: [{ propertyName: "header", first: true, predicate: BrnCalendarHeader, descendants: true, isSignal: true }], ngImport: i0 });
1248
+ /** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "21.2.16", type: BrnCalendarRange, isStandalone: true, selector: "[brnCalendarRange]", inputs: { highlightDays: { classPropertyName: "highlightDays", publicName: "highlightDays", isSignal: true, isRequired: false, transformFunction: null }, min: { classPropertyName: "min", publicName: "min", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, dateDisabled: { classPropertyName: "dateDisabled", publicName: "dateDisabled", isSignal: true, isRequired: false, transformFunction: null }, weekStartsOn: { classPropertyName: "weekStartsOn", publicName: "weekStartsOn", isSignal: true, isRequired: false, transformFunction: null }, defaultFocusedDate: { classPropertyName: "defaultFocusedDate", publicName: "defaultFocusedDate", isSignal: true, isRequired: false, transformFunction: null }, startDate: { classPropertyName: "startDate", publicName: "startDate", isSignal: true, isRequired: false, transformFunction: null }, endDate: { classPropertyName: "endDate", publicName: "endDate", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { focusedDateChange: "focusedDateChange", startDate: "startDateChange", endDate: "endDateChange" }, providers: [provideBrnCalendar(BrnCalendarRange)], queries: [{ propertyName: "header", first: true, predicate: BrnCalendarHeader, descendants: true, isSignal: true }], ngImport: i0 });
1201
1249
  }
1202
1250
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.16", ngImport: i0, type: BrnCalendarRange, decorators: [{
1203
1251
  type: Directive,
@@ -1205,7 +1253,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.16", ngImpo
1205
1253
  selector: '[brnCalendarRange]',
1206
1254
  providers: [provideBrnCalendar(BrnCalendarRange)],
1207
1255
  }]
1208
- }], propDecorators: { highlightDays: [{ type: i0.Input, args: [{ isSignal: true, alias: "highlightDays", required: false }] }], min: [{ type: i0.Input, args: [{ isSignal: true, alias: "min", required: false }] }], max: [{ type: i0.Input, args: [{ isSignal: true, alias: "max", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], dateDisabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "dateDisabled", required: false }] }], weekStartsOn: [{ type: i0.Input, args: [{ isSignal: true, alias: "weekStartsOn", required: false }] }], defaultFocusedDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "defaultFocusedDate", required: false }] }], header: [{ type: i0.ContentChild, args: [i0.forwardRef(() => BrnCalendarHeader), { isSignal: true }] }], startDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "startDate", required: false }] }, { type: i0.Output, args: ["startDateChange"] }], endDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "endDate", required: false }] }, { type: i0.Output, args: ["endDateChange"] }] } });
1256
+ }], propDecorators: { highlightDays: [{ type: i0.Input, args: [{ isSignal: true, alias: "highlightDays", required: false }] }], min: [{ type: i0.Input, args: [{ isSignal: true, alias: "min", required: false }] }], max: [{ type: i0.Input, args: [{ isSignal: true, alias: "max", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], dateDisabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "dateDisabled", required: false }] }], weekStartsOn: [{ type: i0.Input, args: [{ isSignal: true, alias: "weekStartsOn", required: false }] }], defaultFocusedDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "defaultFocusedDate", required: false }] }], header: [{ type: i0.ContentChild, args: [i0.forwardRef(() => BrnCalendarHeader), { isSignal: true }] }], focusedDateChange: [{ type: i0.Output, args: ["focusedDateChange"] }], startDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "startDate", required: false }] }, { type: i0.Output, args: ["startDateChange"] }], endDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "endDate", required: false }] }, { type: i0.Output, args: ["endDateChange"] }] } });
1209
1257
 
1210
1258
  const BrnMonthYearCalendarToken = new InjectionToken('BrnMonthYearCalendarToken');
1211
1259
  function provideBrnMonthYearCalendar(instance) {
@@ -1269,6 +1317,12 @@ class BrnMonthYearCalendar {
1269
1317
  header = contentChild(BrnMonthYearCalendarHeader, ...(ngDevMode ? [{ debugName: "header" }] : /* istanbul ignore next */ []));
1270
1318
  /** The focused date. */
1271
1319
  focusedDate = linkedSignal(() => this.constrainDate(this.defaultFocusedDate() ?? this.date() ?? this._dateAdapter.now()), ...(ngDevMode ? [{ debugName: "focusedDate" }] : /* istanbul ignore next */ []));
1320
+ /** Emits whenever the focused date changes. */
1321
+ focusedDateChange = output();
1322
+ _setFocusedDate(date) {
1323
+ this.focusedDate.set(date);
1324
+ this.focusedDateChange.emit(date);
1325
+ }
1272
1326
  _cells = [];
1273
1327
  /** The 12 months of the currently focused year. */
1274
1328
  months = computed(() => {
@@ -1310,7 +1364,7 @@ class BrnMonthYearCalendar {
1310
1364
  else {
1311
1365
  this.date.set(month);
1312
1366
  }
1313
- this.focusedDate.set(month);
1367
+ this._setFocusedDate(month);
1314
1368
  }
1315
1369
  selectYear(date) {
1316
1370
  if (this.isYearDisabled(date)) {
@@ -1321,7 +1375,7 @@ class BrnMonthYearCalendar {
1321
1375
  if (this.isMonthDisabled(target)) {
1322
1376
  target = this._dateAdapter.set(target, { month: 0, day: 1 });
1323
1377
  }
1324
- this.focusedDate.set(target);
1378
+ this._setFocusedDate(target);
1325
1379
  this.view.set('month');
1326
1380
  // focus the first available month once the month view is rendered.
1327
1381
  this._focusCell((cell) => !this.isMonthDisabled(cell));
@@ -1374,7 +1428,7 @@ class BrnMonthYearCalendar {
1374
1428
  if (this.isMonthDisabled(date)) {
1375
1429
  return;
1376
1430
  }
1377
- this.focusedDate.set(this._dateAdapter.startOfMonth(date));
1431
+ this._setFocusedDate(this._dateAdapter.startOfMonth(date));
1378
1432
  this._focusCell((cell) => this._dateAdapter.isSameMonth(cell, date) && this._dateAdapter.isSameYear(cell, date));
1379
1433
  }
1380
1434
  setFocusedYear(date) {
@@ -1382,7 +1436,7 @@ class BrnMonthYearCalendar {
1382
1436
  return;
1383
1437
  }
1384
1438
  const year = this._dateAdapter.getYear(date);
1385
- this.focusedDate.set(this._dateAdapter.set(this.focusedDate(), { year }));
1439
+ this._setFocusedDate(this._dateAdapter.set(this.focusedDate(), { year }));
1386
1440
  this._focusCell((cell) => this._dateAdapter.isSameYear(cell, date));
1387
1441
  }
1388
1442
  goToPrevious() {
@@ -1390,14 +1444,14 @@ class BrnMonthYearCalendar {
1390
1444
  return;
1391
1445
  }
1392
1446
  const amount = this.view() === 'month' ? 1 : YEARS_PER_PAGE;
1393
- this.focusedDate.set(this._dateAdapter.subtract(this.focusedDate(), { years: amount }));
1447
+ this._setFocusedDate(this._dateAdapter.subtract(this.focusedDate(), { years: amount }));
1394
1448
  }
1395
1449
  goToNext() {
1396
1450
  if (this.isNextDisabled()) {
1397
1451
  return;
1398
1452
  }
1399
1453
  const amount = this.view() === 'month' ? 1 : YEARS_PER_PAGE;
1400
- this.focusedDate.set(this._dateAdapter.add(this.focusedDate(), { years: amount }));
1454
+ this._setFocusedDate(this._dateAdapter.add(this.focusedDate(), { years: amount }));
1401
1455
  }
1402
1456
  isPreviousDisabled() {
1403
1457
  if (this.disabled()) {
@@ -1448,7 +1502,7 @@ class BrnMonthYearCalendar {
1448
1502
  }
1449
1503
  }
1450
1504
  /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.16", ngImport: i0, type: BrnMonthYearCalendar, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1451
- /** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "21.2.16", type: BrnMonthYearCalendar, isStandalone: true, selector: "[brnMonthYearCalendar]", inputs: { min: { classPropertyName: "min", publicName: "min", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, date: { classPropertyName: "date", publicName: "date", isSignal: true, isRequired: false, transformFunction: null }, defaultFocusedDate: { classPropertyName: "defaultFocusedDate", publicName: "defaultFocusedDate", isSignal: true, isRequired: false, transformFunction: null }, viewInput: { classPropertyName: "viewInput", publicName: "view", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { date: "dateChange" }, providers: [provideBrnMonthYearCalendar(BrnMonthYearCalendar)], queries: [{ propertyName: "header", first: true, predicate: BrnMonthYearCalendarHeader, descendants: true, isSignal: true }], ngImport: i0 });
1505
+ /** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "21.2.16", type: BrnMonthYearCalendar, isStandalone: true, selector: "[brnMonthYearCalendar]", inputs: { min: { classPropertyName: "min", publicName: "min", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, date: { classPropertyName: "date", publicName: "date", isSignal: true, isRequired: false, transformFunction: null }, defaultFocusedDate: { classPropertyName: "defaultFocusedDate", publicName: "defaultFocusedDate", isSignal: true, isRequired: false, transformFunction: null }, viewInput: { classPropertyName: "viewInput", publicName: "view", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { date: "dateChange", focusedDateChange: "focusedDateChange" }, providers: [provideBrnMonthYearCalendar(BrnMonthYearCalendar)], queries: [{ propertyName: "header", first: true, predicate: BrnMonthYearCalendarHeader, descendants: true, isSignal: true }], ngImport: i0 });
1452
1506
  }
1453
1507
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.16", ngImport: i0, type: BrnMonthYearCalendar, decorators: [{
1454
1508
  type: Directive,
@@ -1456,7 +1510,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.16", ngImpo
1456
1510
  selector: '[brnMonthYearCalendar]',
1457
1511
  providers: [provideBrnMonthYearCalendar(BrnMonthYearCalendar)],
1458
1512
  }]
1459
- }], propDecorators: { min: [{ type: i0.Input, args: [{ isSignal: true, alias: "min", required: false }] }], max: [{ type: i0.Input, args: [{ isSignal: true, alias: "max", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], date: [{ type: i0.Input, args: [{ isSignal: true, alias: "date", required: false }] }, { type: i0.Output, args: ["dateChange"] }], defaultFocusedDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "defaultFocusedDate", required: false }] }], viewInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "view", required: false }] }], header: [{ type: i0.ContentChild, args: [i0.forwardRef(() => BrnMonthYearCalendarHeader), { isSignal: true }] }] } });
1513
+ }], propDecorators: { min: [{ type: i0.Input, args: [{ isSignal: true, alias: "min", required: false }] }], max: [{ type: i0.Input, args: [{ isSignal: true, alias: "max", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], date: [{ type: i0.Input, args: [{ isSignal: true, alias: "date", required: false }] }, { type: i0.Output, args: ["dateChange"] }], defaultFocusedDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "defaultFocusedDate", required: false }] }], viewInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "view", required: false }] }], header: [{ type: i0.ContentChild, args: [i0.forwardRef(() => BrnMonthYearCalendarHeader), { isSignal: true }] }], focusedDateChange: [{ type: i0.Output, args: ["focusedDateChange"] }] } });
1460
1514
 
1461
1515
  class BrnMonthYearCalendarGrid {
1462
1516
  /** Access the month/year selector */