ng-primitives 0.70.0 → 0.72.0

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.
@@ -20,7 +20,20 @@ export declare class NgpAccordionContent<T> {
20
20
  * The id of the content region
21
21
  */
22
22
  readonly id: import("@angular/core").InputSignal<string>;
23
+ /**
24
+ * The dimensions of the content
25
+ */
26
+ private dimensions;
27
+ /**
28
+ * The hidden until-found state of the content
29
+ */
30
+ protected readonly hidden: import("@angular/core").Signal<"until-found" | null>;
23
31
  constructor();
32
+ /**
33
+ * Handle the beforematch event to automatically open the accordion item
34
+ * when the browser's find-in-page functionality tries to reveal hidden content.
35
+ */
36
+ protected onBeforeMatch(): void;
24
37
  private updateDimensions;
25
38
  static ɵfac: i0.ɵɵFactoryDeclaration<NgpAccordionContent<any>, never>;
26
39
  static ɵdir: i0.ɵɵDirectiveDeclaration<NgpAccordionContent<any>, "[ngpAccordionContent]", ["ngpAccordionContent"], { "id": { "alias": "id"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
@@ -0,0 +1,22 @@
1
+ import { InjectionToken, Provider } from '@angular/core';
2
+ import { NgpDatePickerFirstDayOfWeekNumber } from '../date-picker/date-picker-first-day-of-week';
3
+ export interface NgpDatePickerConfig {
4
+ /**
5
+ * Define the first day of the week for the date picker calendar.
6
+ * @default 7 (Sunday)
7
+ */
8
+ firstDayOfWeek: NgpDatePickerFirstDayOfWeekNumber;
9
+ }
10
+ export declare const defaultDatePickerConfig: NgpDatePickerConfig;
11
+ export declare const NgpDatePickerConfigToken: InjectionToken<NgpDatePickerConfig>;
12
+ /**
13
+ * Provide the default DatePicker / DateRangePicker configuration
14
+ * @param config The DatePicker / DateRangePicker configuration
15
+ * @returns The provider
16
+ */
17
+ export declare function provideDatePickerConfig(config: Partial<NgpDatePickerConfig>): Provider[];
18
+ /**
19
+ * Inject the DatePicker / DateRangePicker configuration
20
+ * @returns The global DatePicker / DateRangePicker configuration
21
+ */
22
+ export declare function injectDatePickerConfig(): NgpDatePickerConfig;
@@ -0,0 +1,29 @@
1
+ /**
2
+ * The first day of the week as a number (0-7).
3
+ * - `1` = Monday
4
+ * - `2` = Tuesday
5
+ * - `3` = Wednesday
6
+ * - `4` = Thursday
7
+ * - `5` = Friday
8
+ * - `6` = Saturday
9
+ * - `7` = Sunday
10
+ */
11
+ export type NgpDatePickerFirstDayOfWeekNumber = 1 | 2 | 3 | 4 | 5 | 6 | 7;
12
+ /**
13
+ * The first day of the week as a number (0-7).
14
+ * - `1` = Monday
15
+ * - `2` = Tuesday
16
+ * - `3` = Wednesday
17
+ * - `4` = Thursday
18
+ * - `5` = Friday
19
+ * - `6` = Saturday
20
+ * - `7` = Sunday
21
+ */
22
+ export type NgpDatePickerFirstDayOfWeekNumberInput = NgpDatePickerFirstDayOfWeekNumber | `${NgpDatePickerFirstDayOfWeekNumber}`;
23
+ /**
24
+ * Transform the first day of the week input value to a number (0-7) for the start of the week in
25
+ * the calendar.
26
+ * @param firstDayOfWeek The first day of the week input value (number).
27
+ * @returns The first day of the week number.
28
+ */
29
+ export declare function transformToFirstDayOfWeekNumber(firstDayOfWeek: NgpDatePickerFirstDayOfWeekNumberInput): NgpDatePickerFirstDayOfWeekNumber;
@@ -10,6 +10,10 @@ export declare class NgpDatePicker<T> {
10
10
  * Access the date adapter.
11
11
  */
12
12
  private readonly dateAdapter;
13
+ /**
14
+ * Access the date picker config.
15
+ */
16
+ private readonly config;
13
17
  /**
14
18
  * Access the injector.
15
19
  */
@@ -30,6 +34,14 @@ export declare class NgpDatePicker<T> {
30
34
  * A function that is called to determine if a specific date should be disabled.
31
35
  */
32
36
  readonly dateDisabled: import("@angular/core").InputSignal<(date: T) => boolean>;
37
+ /**
38
+ * Sets which day starts the week in the calendar.
39
+ * Accepts 0-7 where 1=Monday, 2=Tuesday, 3=Wednesday, 4=Thursday, 5=Friday, 6=Saturday, 7=Sunday.
40
+ * Defaults to NgpDatePickerConfig.firstDayOfWeek (default 7 if not overridden).
41
+ * Note: Update calendar header column order when changing from Sunday start.
42
+ * @default 7 (Sunday)
43
+ */
44
+ readonly firstDayOfWeek: import("@angular/core").InputSignalWithTransform<import("./date-picker-first-day-of-week").NgpDatePickerFirstDayOfWeekNumber, import("./date-picker-first-day-of-week").NgpDatePickerFirstDayOfWeekNumberInput>;
33
45
  /**
34
46
  * The selected value.
35
47
  */
@@ -112,5 +124,5 @@ export declare class NgpDatePicker<T> {
112
124
  */
113
125
  isBetweenRange(_: T): boolean;
114
126
  static ɵfac: i0.ɵɵFactoryDeclaration<NgpDatePicker<any>, never>;
115
- static ɵdir: i0.ɵɵDirectiveDeclaration<NgpDatePicker<any>, "[ngpDatePicker]", ["ngpDatePicker"], { "min": { "alias": "ngpDatePickerMin"; "required": false; "isSignal": true; }; "max": { "alias": "ngpDatePickerMax"; "required": false; "isSignal": true; }; "disabled": { "alias": "ngpDatePickerDisabled"; "required": false; "isSignal": true; }; "dateDisabled": { "alias": "ngpDatePickerDateDisabled"; "required": false; "isSignal": true; }; "date": { "alias": "ngpDatePickerDate"; "required": false; "isSignal": true; }; "focusedDate": { "alias": "ngpDatePickerFocusedDate"; "required": false; "isSignal": true; }; }, { "dateChange": "ngpDatePickerDateChange"; "focusedDateChange": "ngpDatePickerFocusedDateChange"; }, ["label"], never, true, never>;
127
+ static ɵdir: i0.ɵɵDirectiveDeclaration<NgpDatePicker<any>, "[ngpDatePicker]", ["ngpDatePicker"], { "min": { "alias": "ngpDatePickerMin"; "required": false; "isSignal": true; }; "max": { "alias": "ngpDatePickerMax"; "required": false; "isSignal": true; }; "disabled": { "alias": "ngpDatePickerDisabled"; "required": false; "isSignal": true; }; "dateDisabled": { "alias": "ngpDatePickerDateDisabled"; "required": false; "isSignal": true; }; "firstDayOfWeek": { "alias": "ngpDatePickerFirstDayOfWeek"; "required": false; "isSignal": true; }; "date": { "alias": "ngpDatePickerDate"; "required": false; "isSignal": true; }; "focusedDate": { "alias": "ngpDatePickerFocusedDate"; "required": false; "isSignal": true; }; }, { "dateChange": "ngpDatePickerDateChange"; "focusedDateChange": "ngpDatePickerFocusedDateChange"; }, ["label"], never, true, never>;
116
128
  }
@@ -30,6 +30,10 @@ export declare class NgpDatePickerRowRender<T> implements OnDestroy {
30
30
  * Store the embedded view refs of each rendered row.
31
31
  */
32
32
  private readonly viewRefs;
33
+ /**
34
+ * Store the previously rendered month.
35
+ */
36
+ private previousMonth;
33
37
  constructor();
34
38
  ngOnDestroy(): void;
35
39
  /**
@@ -40,6 +44,14 @@ export declare class NgpDatePickerRowRender<T> implements OnDestroy {
40
44
  * Destroy the row.
41
45
  */
42
46
  private destroyRows;
47
+ /**
48
+ * Get the offset of the first day of the week.
49
+ * @param firstCalendarDay The first day of the calendar without the offset.
50
+ * @returns The offset of the first day of the week.
51
+ *
52
+ * @internal
53
+ */
54
+ getFirstDayOfWeekOffset(firstCalendarDay: T): number;
43
55
  static ɵfac: i0.ɵɵFactoryDeclaration<NgpDatePickerRowRender<any>, never>;
44
56
  static ɵdir: i0.ɵɵDirectiveDeclaration<NgpDatePickerRowRender<any>, "[ngpDatePickerRowRender]", ["ngpDatePickerRowRender"], {}, {}, never, never, true, never>;
45
57
  }
@@ -4,6 +4,10 @@ import { NgpDatePickerDateButton } from '../date-picker-date-button/date-picker-
4
4
  import * as i0 from "@angular/core";
5
5
  export declare class NgpDateRangePicker<T> {
6
6
  private readonly dateAdapter;
7
+ /**
8
+ * Access the date range picker config.
9
+ */
10
+ private readonly config;
7
11
  /**
8
12
  * Access the injector.
9
13
  */
@@ -24,6 +28,14 @@ export declare class NgpDateRangePicker<T> {
24
28
  * A function that is called to determine if a specific date should be disabled.
25
29
  */
26
30
  readonly dateDisabled: import("@angular/core").InputSignal<(date: T) => boolean>;
31
+ /**
32
+ * Sets which day starts the week in the calendar.
33
+ * Accepts 0-7 where 1=Monday, 2=Tuesday, 3=Wednesday, 4=Thursday, 5=Friday, 6=Saturday, 7=Sunday.
34
+ * Defaults to NgpDatePickerConfig.firstDayOfWeek (default 7 if not overridden).
35
+ * Note: Update calendar header column order when changing from Sunday start.
36
+ * @default 7 (Sunday)
37
+ */
38
+ readonly firstDayOfWeek: import("@angular/core").InputSignalWithTransform<import("../date-picker/date-picker-first-day-of-week").NgpDatePickerFirstDayOfWeekNumber, import("../date-picker/date-picker-first-day-of-week").NgpDatePickerFirstDayOfWeekNumberInput>;
27
39
  /**
28
40
  * The selected start date
29
41
  */
@@ -128,5 +140,5 @@ export declare class NgpDateRangePicker<T> {
128
140
  */
129
141
  isBetweenRange(date: T): boolean;
130
142
  static ɵfac: i0.ɵɵFactoryDeclaration<NgpDateRangePicker<any>, never>;
131
- static ɵdir: i0.ɵɵDirectiveDeclaration<NgpDateRangePicker<any>, "[ngpDateRangePicker]", ["ngpDateRangePicker"], { "min": { "alias": "ngpDateRangePickerMin"; "required": false; "isSignal": true; }; "max": { "alias": "ngpDateRangePickerMax"; "required": false; "isSignal": true; }; "disabled": { "alias": "ngpDateRangePickerDisabled"; "required": false; "isSignal": true; }; "dateDisabled": { "alias": "ngpDateRangePickerDateDisabled"; "required": false; "isSignal": true; }; "startDate": { "alias": "ngpDateRangePickerStartDate"; "required": false; "isSignal": true; }; "endDate": { "alias": "ngpDateRangePickerEndDate"; "required": false; "isSignal": true; }; "focusedDate": { "alias": "ngpDateRangePickerFocusedDate"; "required": false; "isSignal": true; }; }, { "startDateChange": "ngpDateRangePickerStartDateChange"; "endDateChange": "ngpDateRangePickerEndDateChange"; "focusedDateChange": "ngpDateRangePickerFocusedDateChange"; }, ["label"], never, true, never>;
143
+ static ɵdir: i0.ɵɵDirectiveDeclaration<NgpDateRangePicker<any>, "[ngpDateRangePicker]", ["ngpDateRangePicker"], { "min": { "alias": "ngpDateRangePickerMin"; "required": false; "isSignal": true; }; "max": { "alias": "ngpDateRangePickerMax"; "required": false; "isSignal": true; }; "disabled": { "alias": "ngpDateRangePickerDisabled"; "required": false; "isSignal": true; }; "dateDisabled": { "alias": "ngpDateRangePickerDateDisabled"; "required": false; "isSignal": true; }; "firstDayOfWeek": { "alias": "ngpDateRangePickerFirstDayOfWeek"; "required": false; "isSignal": true; }; "startDate": { "alias": "ngpDateRangePickerStartDate"; "required": false; "isSignal": true; }; "endDate": { "alias": "ngpDateRangePickerEndDate"; "required": false; "isSignal": true; }; "focusedDate": { "alias": "ngpDateRangePickerFocusedDate"; "required": false; "isSignal": true; }; }, { "startDateChange": "ngpDateRangePickerStartDateChange"; "endDateChange": "ngpDateRangePickerEndDateChange"; "focusedDateChange": "ngpDateRangePickerFocusedDateChange"; }, ["label"], never, true, never>;
132
144
  }
@@ -1,3 +1,4 @@
1
+ export { injectDatePickerConfig, provideDatePickerConfig } from './config/date-picker-config';
1
2
  export { NgpDatePickerCellRender } from './date-picker-cell-render/date-picker-cell-render';
2
3
  export { injectDatePickerCellDate, injectDatePickerCellRender, NgpDatePickerCellRenderToken, } from './date-picker-cell-render/date-picker-cell-render-token';
3
4
  export { NgpDatePickerCell } from './date-picker-cell/date-picker-cell';
@@ -11,6 +12,7 @@ export { NgpDatePickerPreviousMonth } from './date-picker-previous-month/date-pi
11
12
  export { NgpDatePickerRowRender } from './date-picker-row-render/date-picker-row-render';
12
13
  export { injectDatePickerRowRender, injectDatePickerWeek, NgpDatePickerRowRenderToken, } from './date-picker-row-render/date-picker-row-render-token';
13
14
  export { NgpDatePicker } from './date-picker/date-picker';
15
+ export { transformToFirstDayOfWeekNumber, type NgpDatePickerFirstDayOfWeekNumber, type NgpDatePickerFirstDayOfWeekNumberInput, } from './date-picker/date-picker-first-day-of-week';
14
16
  export { injectDatePickerState, provideDatePickerState } from './date-picker/date-picker-state';
15
17
  export { NgpDateRangePicker } from './date-range-picker/date-range-picker';
16
18
  export { provideDateRangePickerState, injectDateRangePickerState, } from './date-range-picker/date-range-picker-state';
@@ -1,6 +1,6 @@
1
1
  import * as i0 from '@angular/core';
2
- import { input, afterRenderEffect, computed, Directive, booleanAttribute, signal, inject, HOST_TAG_NAME, HostListener, InjectionToken, output } from '@angular/core';
3
- import { injectElementRef, fromMutationObserver } from 'ng-primitives/internal';
2
+ import { input, computed, afterRenderEffect, Directive, booleanAttribute, signal, inject, HOST_TAG_NAME, HostListener, InjectionToken, output } from '@angular/core';
3
+ import { injectElementRef, injectDimensions, fromMutationObserver } from 'ng-primitives/internal';
4
4
  import { uniqueId, safeTakeUntilDestroyed } from 'ng-primitives/utils';
5
5
  import { debounceTime } from 'rxjs';
6
6
  import { createStateToken, createStateProvider, createStateInjector, createState } from 'ng-primitives/state';
@@ -60,6 +60,14 @@ class NgpAccordionContent {
60
60
  * The id of the content region
61
61
  */
62
62
  this.id = input(uniqueId('ngp-accordion-content'));
63
+ /**
64
+ * The dimensions of the content
65
+ */
66
+ this.dimensions = injectDimensions();
67
+ /**
68
+ * The hidden until-found state of the content
69
+ */
70
+ this.hidden = computed(() => !this.accordionItem().open() && this.dimensions().height === 0 ? 'until-found' : null);
63
71
  this.accordionItem().content.set(this);
64
72
  // any time the open state of the accordion item changes, update the dimensions
65
73
  afterRenderEffect(() => this.updateDimensions());
@@ -72,6 +80,16 @@ class NgpAccordionContent {
72
80
  .pipe(debounceTime(0), safeTakeUntilDestroyed())
73
81
  .subscribe(() => this.updateDimensions());
74
82
  }
83
+ /**
84
+ * Handle the beforematch event to automatically open the accordion item
85
+ * when the browser's find-in-page functionality tries to reveal hidden content.
86
+ */
87
+ onBeforeMatch() {
88
+ const isDisabled = this.accordion().disabled() || this.accordionItem().disabled();
89
+ if (isDisabled)
90
+ return;
91
+ this.accordion().toggle(this.accordionItem().value());
92
+ }
75
93
  updateDimensions() {
76
94
  if (this.accordionItem().open()) {
77
95
  // remove the inline styles to reset them
@@ -83,7 +101,7 @@ class NgpAccordionContent {
83
101
  }
84
102
  }
85
103
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.11", ngImport: i0, type: NgpAccordionContent, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
86
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.11", type: NgpAccordionContent, isStandalone: true, selector: "[ngpAccordionContent]", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "region" }, properties: { "id": "id()", "attr.data-orientation": "accordion().orientation()", "attr.data-open": "accordionItem().open() ? \"\" : null", "attr.data-closed": "accordionItem().open() ? null : \"\"", "attr.aria-labelledby": "accordionItem().triggerId()" } }, exportAs: ["ngpAccordionContent"], ngImport: i0 }); }
104
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.11", type: NgpAccordionContent, isStandalone: true, selector: "[ngpAccordionContent]", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "region" }, listeners: { "beforematch": "onBeforeMatch()" }, properties: { "id": "id()", "attr.data-orientation": "accordion().orientation()", "attr.data-open": "accordionItem().open() ? \"\" : null", "attr.data-closed": "accordionItem().open() ? null : \"\"", "attr.aria-labelledby": "accordionItem().triggerId()", "attr.hidden": "hidden()" } }, exportAs: ["ngpAccordionContent"], ngImport: i0 }); }
87
105
  }
88
106
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.11", ngImport: i0, type: NgpAccordionContent, decorators: [{
89
107
  type: Directive,
@@ -97,6 +115,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.11", ngImpo
97
115
  '[attr.data-open]': 'accordionItem().open() ? "" : null',
98
116
  '[attr.data-closed]': 'accordionItem().open() ? null : ""',
99
117
  '[attr.aria-labelledby]': 'accordionItem().triggerId()',
118
+ '(beforematch)': 'onBeforeMatch()',
119
+ '[attr.hidden]': 'hidden()',
100
120
  },
101
121
  }]
102
122
  }], ctorParameters: () => [] });
@@ -1 +1 @@
1
- {"version":3,"file":"ng-primitives-accordion.mjs","sources":["../../../../packages/ng-primitives/accordion/src/accordion-item/accordion-item-state.ts","../../../../packages/ng-primitives/accordion/src/accordion/accordion-state.ts","../../../../packages/ng-primitives/accordion/src/accordion-content/accordion-content.ts","../../../../packages/ng-primitives/accordion/src/accordion-item/accordion-item.ts","../../../../packages/ng-primitives/accordion/src/accordion-trigger/accordion-trigger.ts","../../../../packages/ng-primitives/accordion/src/config/accordion-config.ts","../../../../packages/ng-primitives/accordion/src/accordion/accordion.ts","../../../../packages/ng-primitives/accordion/src/ng-primitives-accordion.ts"],"sourcesContent":["import {\n createState,\n createStateInjector,\n createStateProvider,\n createStateToken,\n} from 'ng-primitives/state';\nimport type { NgpAccordionItem } from './accordion-item';\n\n/**\n * The state token for the AccordionItem primitive.\n */\nexport const NgpAccordionItemStateToken =\n createStateToken<NgpAccordionItem<unknown>>('AccordionItem');\n\n/**\n * Provides the AccordionItem state.\n */\nexport const provideAccordionItemState = createStateProvider(NgpAccordionItemStateToken);\n\n/**\n * Injects the AccordionItem state.\n */\nexport const injectAccordionItemState = createStateInjector<NgpAccordionItem<unknown>>(\n NgpAccordionItemStateToken,\n);\n\n/**\n * The AccordionItem state registration function.\n */\nexport const accordionItemState = createState(NgpAccordionItemStateToken);\n","import {\n createState,\n createStateInjector,\n createStateProvider,\n createStateToken,\n} from 'ng-primitives/state';\nimport type { NgpAccordion } from './accordion';\n\n/**\n * The state token for the Accordion primitive.\n */\nexport const NgpAccordionStateToken = createStateToken<NgpAccordion<unknown>>('Accordion');\n\n/**\n * Provides the Accordion state.\n */\nexport const provideAccordionState = createStateProvider(NgpAccordionStateToken);\n\n/**\n * Injects the Accordion state.\n */\nexport const injectAccordionState =\n createStateInjector<NgpAccordion<unknown>>(NgpAccordionStateToken);\n\n/**\n * The Accordion state registration function.\n */\nexport const accordionState = createState(NgpAccordionStateToken);\n","import { afterRenderEffect, computed, Directive, input } from '@angular/core';\nimport { fromMutationObserver, injectElementRef } from 'ng-primitives/internal';\nimport { safeTakeUntilDestroyed, uniqueId } from 'ng-primitives/utils';\nimport { debounceTime } from 'rxjs';\nimport { injectAccordionItemState } from '../accordion-item/accordion-item-state';\nimport type { NgpAccordion } from '../accordion/accordion';\nimport { injectAccordionState } from '../accordion/accordion-state';\n\n/**\n * Apply the `ngpAccordionContent` directive to an element that represents the content of an accordion item.\n */\n@Directive({\n selector: '[ngpAccordionContent]',\n exportAs: 'ngpAccordionContent',\n host: {\n role: 'region',\n '[id]': 'id()',\n '[attr.data-orientation]': 'accordion().orientation()',\n '[attr.data-open]': 'accordionItem().open() ? \"\" : null',\n '[attr.data-closed]': 'accordionItem().open() ? null : \"\"',\n '[attr.aria-labelledby]': 'accordionItem().triggerId()',\n },\n})\nexport class NgpAccordionContent<T> {\n /**\n * Access the accordion content element reference\n */\n private readonly elementRef = injectElementRef();\n\n /**\n * Access the accordion\n */\n protected readonly accordion = injectAccordionState<NgpAccordion<T>>();\n\n /**\n * Access the accordion item\n */\n protected readonly accordionItem = injectAccordionItemState();\n\n /**\n * The id of the content region\n */\n readonly id = input<string>(uniqueId('ngp-accordion-content'));\n\n constructor() {\n this.accordionItem().content.set(this);\n\n // any time the open state of the accordion item changes, update the dimensions\n afterRenderEffect(() => this.updateDimensions());\n\n // update dimensions when the content changes\n fromMutationObserver(this.elementRef.nativeElement, {\n childList: true,\n subtree: true,\n disabled: computed(() => !this.accordionItem().open()),\n })\n .pipe(debounceTime(0), safeTakeUntilDestroyed())\n .subscribe(() => this.updateDimensions());\n }\n\n private updateDimensions(): void {\n if (this.accordionItem().open()) {\n // remove the inline styles to reset them\n this.elementRef.nativeElement.style.removeProperty('--ngp-accordion-content-width');\n this.elementRef.nativeElement.style.removeProperty('--ngp-accordion-content-height');\n // set the dimensions based on the content\n this.elementRef.nativeElement.style.setProperty(\n '--ngp-accordion-content-width',\n `${this.elementRef.nativeElement.scrollWidth}px`,\n );\n this.elementRef.nativeElement.style.setProperty(\n '--ngp-accordion-content-height',\n `${this.elementRef.nativeElement.scrollHeight}px`,\n );\n }\n }\n}\n","import { BooleanInput } from '@angular/cdk/coercion';\nimport { Directive, booleanAttribute, computed, input, signal } from '@angular/core';\nimport { uniqueId } from 'ng-primitives/utils';\nimport { NgpAccordionContent } from '../accordion-content/accordion-content';\nimport { NgpAccordionTrigger } from '../accordion-trigger/accordion-trigger';\nimport { NgpAccordion } from '../accordion/accordion';\nimport { injectAccordionState } from '../accordion/accordion-state';\nimport { accordionItemState, provideAccordionItemState } from './accordion-item-state';\n\n/**\n * Apply the `ngpAccordionItem` directive to an element that represents an accordion item.\n */\n@Directive({\n selector: '[ngpAccordionItem]',\n exportAs: 'ngpAccordionItem',\n providers: [provideAccordionItemState()],\n host: {\n '[attr.data-orientation]': 'accordion().orientation()',\n '[attr.data-open]': 'state.open() ? \"\" : null',\n '[attr.data-disabled]': 'state.disabled() || accordion().disabled() ? \"\" : null',\n },\n})\nexport class NgpAccordionItem<T> {\n /**\n * Access the accordion.\n */\n protected readonly accordion = injectAccordionState<NgpAccordion<T>>();\n\n /**\n * The value of the accordion item.\n */\n readonly value = input<T>(uniqueId('ngp-accordion-item') as T, {\n alias: 'ngpAccordionItemValue',\n });\n\n /**\n * Whether the accordion item is disabled.\n */\n readonly disabled = input<boolean, BooleanInput>(false, {\n alias: 'ngpAccordionItemDisabled',\n transform: booleanAttribute,\n });\n\n /**\n * Access the accordion trigger\n * @internal\n */\n readonly trigger = signal<NgpAccordionTrigger<T> | undefined>(undefined);\n\n /**\n * Access the accordion content\n * @internal\n */\n readonly content = signal<NgpAccordionContent<T> | undefined>(undefined);\n\n /**\n * Whether the accordion item is expanded.\n */\n readonly open = computed<boolean>(() => this.accordion().isOpen(this.state.value()!));\n\n /**\n * The trigger id.\n */\n readonly triggerId = computed(() => this.trigger()?.id());\n\n /**\n * The content id.\n */\n readonly contentId = computed(() => this.content()?.id());\n\n /**\n * The accordion item state.\n */\n private readonly state = accordionItemState<NgpAccordionItem<T>>(this);\n}\n","import { Directive, HOST_TAG_NAME, HostListener, inject, input } from '@angular/core';\nimport { uniqueId } from 'ng-primitives/utils';\nimport { NgpAccordionItem } from '../accordion-item/accordion-item';\nimport { injectAccordionItemState } from '../accordion-item/accordion-item-state';\nimport { NgpAccordion } from '../accordion/accordion';\nimport { injectAccordionState } from '../accordion/accordion-state';\n\n/**\n * Apply the `ngpAccordionTrigger` directive to an element that represents the trigger for an accordion item, such as a button.\n */\n@Directive({\n selector: '[ngpAccordionTrigger]',\n exportAs: 'ngpAccordionTrigger',\n host: {\n '[id]': 'id()',\n '[attr.type]': 'tagName === \"button\" ? \"button\" : null',\n '[attr.data-orientation]': 'accordion().orientation()',\n '[attr.data-open]': 'accordionItem().open() ? \"\" : null',\n '[attr.data-disabled]': 'accordionItem().disabled() || accordion().disabled() ? \"\" : null',\n '[attr.aria-controls]': 'accordionItem().contentId()',\n '[attr.aria-expanded]': 'accordionItem().open()',\n },\n})\nexport class NgpAccordionTrigger<T> {\n /**\n * The tag name of the element.\n */\n protected readonly tagName = inject(HOST_TAG_NAME);\n\n /**\n * Access the parent accordion.\n */\n protected readonly accordion = injectAccordionState<NgpAccordion<T>>();\n\n /**\n * The item instance.\n */\n protected readonly accordionItem = injectAccordionItemState<NgpAccordionItem<T>>();\n\n /**\n * The id of the trigger.\n */\n readonly id = input<string>(uniqueId('ngp-accordion-trigger'));\n\n constructor() {\n this.accordionItem().trigger.set(this);\n }\n\n /**\n * Toggle the accordion item.\n */\n @HostListener('click')\n toggle(): void {\n if (this.accordionItem().disabled() || this.accordion().disabled()) {\n return;\n }\n\n this.accordion().toggle(this.accordionItem().value()!);\n }\n}\n","import { InjectionToken, Provider, inject } from '@angular/core';\nimport { NgpAccordionType } from '../accordion/accordion';\n\nexport interface NgpAccordionConfig {\n /**\n * The default type of the accordion\n * @default 'single'\n */\n type: NgpAccordionType;\n /**\n * Whether the accordion is collapsible\n * @default false\n */\n collapsible: boolean;\n /**\n * The default orientation of the accordion\n * @default 'vertical'\n */\n orientation: 'vertical' | 'horizontal';\n}\n\nexport const defaultAccordionConfig: NgpAccordionConfig = {\n type: 'single',\n collapsible: false,\n orientation: 'vertical',\n};\n\nexport const NgpAccordionConfigToken = new InjectionToken<NgpAccordionConfig>(\n 'NgpAccordionConfigToken',\n);\n\n/**\n * Provide the default Accordion configuration\n * @param config The Accordion configuration\n * @returns The provider\n */\nexport function provideAccordionConfig(config: Partial<NgpAccordionConfig>): Provider[] {\n return [\n {\n provide: NgpAccordionConfigToken,\n useValue: { ...defaultAccordionConfig, ...config },\n },\n ];\n}\n\n/**\n * Inject the Accordion configuration\n * @returns The global Accordion configuration\n */\nexport function injectAccordionConfig(): NgpAccordionConfig {\n return inject(NgpAccordionConfigToken, { optional: true }) ?? defaultAccordionConfig;\n}\n","import { BooleanInput } from '@angular/cdk/coercion';\nimport { Directive, booleanAttribute, input, output } from '@angular/core';\nimport { NgpOrientation } from 'ng-primitives/common';\nimport { injectAccordionConfig } from '../config/accordion-config';\nimport { accordionState, provideAccordionState } from './accordion-state';\n\n/**\n * Apply the `ngpAccordion` directive to an element that represents the group of accordion items.\n */\n@Directive({\n selector: '[ngpAccordion]',\n exportAs: 'ngpAccordion',\n providers: [provideAccordionState()],\n host: {\n '[attr.data-orientation]': 'state.orientation()',\n '[attr.data-disabled]': 'state.disabled() ? \"\" : null',\n },\n})\nexport class NgpAccordion<T> {\n /**\n * Access the global accordion configuration.\n */\n private readonly config = injectAccordionConfig();\n\n /**\n * The type of the accordion.\n */\n readonly type = input<NgpAccordionType>(this.config.type, {\n alias: 'ngpAccordionType',\n });\n\n /**\n * Whether the accordion is collapsible.\n */\n readonly collapsible = input<boolean, BooleanInput>(this.config.collapsible, {\n alias: 'ngpAccordionCollapsible',\n transform: booleanAttribute,\n });\n\n /**\n * The value of the accordion.\n */\n readonly value = input<T | T[] | null>(null, {\n alias: 'ngpAccordionValue',\n });\n\n /**\n * Event emitted when the accordion value changes.\n */\n readonly valueChange = output<T | T[] | null>({\n alias: 'ngpAccordionValueChange',\n });\n\n /**\n * Whether the accordion is disabled.\n */\n readonly disabled = input<boolean, BooleanInput>(false, {\n alias: 'ngpAccordionDisabled',\n transform: booleanAttribute,\n });\n\n /**\n * The accordion orientation.\n */\n readonly orientation = input<NgpOrientation>(this.config.orientation, {\n alias: 'ngpAccordionOrientation',\n });\n\n /**\n * The accordion state.\n */\n private readonly state = accordionState<NgpAccordion<T>>(this);\n\n /**\n * @param value The value to check.\n * @returns Whether the value is open.\n * @internal\n */\n isOpen(value: T): boolean {\n if (this.state.type() === 'multiple') {\n return (this.state.value() as T[] | null)?.includes(value) ?? false;\n }\n\n return this.state.value() === value;\n }\n\n toggle(value: T): void {\n const isOpen = this.isOpen(value);\n\n // if we are in single mode and the value is already open and the accordion is not collapsible, do nothing\n if (this.state.type() === 'single' && isOpen && !this.state.collapsible()) {\n return;\n }\n\n // if we are in single mode then toggle the value\n if (this.state.type() === 'single') {\n const newValue = isOpen ? null : value;\n this.state.value.set(newValue);\n this.valueChange.emit(newValue);\n return;\n }\n\n // if we are in multiple mode then toggle the value\n let values = (this.state.value() as T[]) ?? [];\n\n if (isOpen) {\n values = values.filter(v => v !== value);\n } else {\n values = [...values, value];\n }\n this.state.value.set(values);\n this.valueChange.emit(values);\n }\n}\n\nexport type NgpAccordionType = 'single' | 'multiple';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;AAQA;;AAEG;AACI,MAAM,0BAA0B,GACrC,gBAAgB,CAA4B,eAAe,CAAC;AAE9D;;AAEG;MACU,yBAAyB,GAAG,mBAAmB,CAAC,0BAA0B;AAEvF;;AAEG;MACU,wBAAwB,GAAG,mBAAmB,CACzD,0BAA0B;AAG5B;;AAEG;AACI,MAAM,kBAAkB,GAAG,WAAW,CAAC,0BAA0B,CAAC;;ACrBzE;;AAEG;AACI,MAAM,sBAAsB,GAAG,gBAAgB,CAAwB,WAAW,CAAC;AAE1F;;AAEG;MACU,qBAAqB,GAAG,mBAAmB,CAAC,sBAAsB;AAE/E;;AAEG;MACU,oBAAoB,GAC/B,mBAAmB,CAAwB,sBAAsB;AAEnE;;AAEG;AACI,MA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8B;AACvD,qBAAA;AACF,iBAAA;;;ACjBD;;AAEG;;;;"}
1
+ {"version":3,"file":"ng-primitives-accordion.mjs","sources":["../../../../packages/ng-primitives/accordion/src/accordion-item/accordion-item-state.ts","../../../../packages/ng-primitives/accordion/src/accordion/accordion-state.ts","../../../../packages/ng-primitives/accordion/src/accordion-content/accordion-content.ts","../../../../packages/ng-primitives/accordion/src/accordion-item/accordion-item.ts","../../../../packages/ng-primitives/accordion/src/accordion-trigger/accordion-trigger.ts","../../../../packages/ng-primitives/accordion/src/config/accordion-config.ts","../../../../packages/ng-primitives/accordion/src/accordion/accordion.ts","../../../../packages/ng-primitives/accordion/src/ng-primitives-accordion.ts"],"sourcesContent":["import {\n createState,\n createStateInjector,\n createStateProvider,\n createStateToken,\n} from 'ng-primitives/state';\nimport type { NgpAccordionItem } from './accordion-item';\n\n/**\n * The state token for the AccordionItem primitive.\n */\nexport const NgpAccordionItemStateToken =\n createStateToken<NgpAccordionItem<unknown>>('AccordionItem');\n\n/**\n * Provides the AccordionItem state.\n */\nexport const provideAccordionItemState = createStateProvider(NgpAccordionItemStateToken);\n\n/**\n * Injects the AccordionItem state.\n */\nexport const injectAccordionItemState = createStateInjector<NgpAccordionItem<unknown>>(\n NgpAccordionItemStateToken,\n);\n\n/**\n * The AccordionItem state registration function.\n */\nexport const accordionItemState = createState(NgpAccordionItemStateToken);\n","import {\n createState,\n createStateInjector,\n createStateProvider,\n createStateToken,\n} from 'ng-primitives/state';\nimport type { NgpAccordion } from './accordion';\n\n/**\n * The state token for the Accordion primitive.\n */\nexport const NgpAccordionStateToken = createStateToken<NgpAccordion<unknown>>('Accordion');\n\n/**\n * Provides the Accordion state.\n */\nexport const provideAccordionState = createStateProvider(NgpAccordionStateToken);\n\n/**\n * Injects the Accordion state.\n */\nexport const injectAccordionState =\n createStateInjector<NgpAccordion<unknown>>(NgpAccordionStateToken);\n\n/**\n * The Accordion state registration function.\n */\nexport const accordionState = createState(NgpAccordionStateToken);\n","import { afterRenderEffect, computed, Directive, input } from '@angular/core';\nimport { fromMutationObserver, injectDimensions, injectElementRef } from 'ng-primitives/internal';\nimport { safeTakeUntilDestroyed, uniqueId } from 'ng-primitives/utils';\nimport { debounceTime } from 'rxjs';\nimport { injectAccordionItemState } from '../accordion-item/accordion-item-state';\nimport type { NgpAccordion } from '../accordion/accordion';\nimport { injectAccordionState } from '../accordion/accordion-state';\n\n/**\n * Apply the `ngpAccordionContent` directive to an element that represents the content of an accordion item.\n */\n@Directive({\n selector: '[ngpAccordionContent]',\n exportAs: 'ngpAccordionContent',\n host: {\n role: 'region',\n '[id]': 'id()',\n '[attr.data-orientation]': 'accordion().orientation()',\n '[attr.data-open]': 'accordionItem().open() ? \"\" : null',\n '[attr.data-closed]': 'accordionItem().open() ? null : \"\"',\n '[attr.aria-labelledby]': 'accordionItem().triggerId()',\n '(beforematch)': 'onBeforeMatch()',\n '[attr.hidden]': 'hidden()',\n },\n})\nexport class NgpAccordionContent<T> {\n /**\n * Access the accordion content element reference\n */\n private readonly elementRef = injectElementRef();\n\n /**\n * Access the accordion\n */\n protected readonly accordion = injectAccordionState<NgpAccordion<T>>();\n\n /**\n * Access the accordion item\n */\n protected readonly accordionItem = injectAccordionItemState();\n\n /**\n * The id of the content region\n */\n readonly id = input<string>(uniqueId('ngp-accordion-content'));\n\n /**\n * The dimensions of the content\n */\n private dimensions = injectDimensions();\n\n /**\n * The hidden until-found state of the content\n */\n protected readonly hidden = computed(() =>\n !this.accordionItem().open() && this.dimensions().height === 0 ? 'until-found' : null,\n );\n\n constructor() {\n this.accordionItem().content.set(this);\n\n // any time the open state of the accordion item changes, update the dimensions\n afterRenderEffect(() => this.updateDimensions());\n\n // update dimensions when the content changes\n fromMutationObserver(this.elementRef.nativeElement, {\n childList: true,\n subtree: true,\n disabled: computed(() => !this.accordionItem().open()),\n })\n .pipe(debounceTime(0), safeTakeUntilDestroyed())\n .subscribe(() => this.updateDimensions());\n }\n\n /**\n * Handle the beforematch event to automatically open the accordion item\n * when the browser's find-in-page functionality tries to reveal hidden content.\n */\n protected onBeforeMatch(): void {\n const isDisabled = this.accordion().disabled() || this.accordionItem().disabled();\n if (isDisabled) return;\n this.accordion().toggle(this.accordionItem().value() as T);\n }\n\n private updateDimensions(): void {\n if (this.accordionItem().open()) {\n // remove the inline styles to reset them\n this.elementRef.nativeElement.style.removeProperty('--ngp-accordion-content-width');\n this.elementRef.nativeElement.style.removeProperty('--ngp-accordion-content-height');\n // set the dimensions based on the content\n this.elementRef.nativeElement.style.setProperty(\n '--ngp-accordion-content-width',\n `${this.elementRef.nativeElement.scrollWidth}px`,\n );\n this.elementRef.nativeElement.style.setProperty(\n '--ngp-accordion-content-height',\n `${this.elementRef.nativeElement.scrollHeight}px`,\n );\n }\n }\n}\n","import { BooleanInput } from '@angular/cdk/coercion';\nimport { Directive, booleanAttribute, computed, input, signal } from '@angular/core';\nimport { uniqueId } from 'ng-primitives/utils';\nimport { NgpAccordionContent } from '../accordion-content/accordion-content';\nimport { NgpAccordionTrigger } from '../accordion-trigger/accordion-trigger';\nimport { NgpAccordion } from '../accordion/accordion';\nimport { injectAccordionState } from '../accordion/accordion-state';\nimport { accordionItemState, provideAccordionItemState } from './accordion-item-state';\n\n/**\n * Apply the `ngpAccordionItem` directive to an element that represents an accordion item.\n */\n@Directive({\n selector: '[ngpAccordionItem]',\n exportAs: 'ngpAccordionItem',\n providers: [provideAccordionItemState()],\n host: {\n '[attr.data-orientation]': 'accordion().orientation()',\n '[attr.data-open]': 'state.open() ? \"\" : null',\n '[attr.data-disabled]': 'state.disabled() || accordion().disabled() ? \"\" : null',\n },\n})\nexport class NgpAccordionItem<T> {\n /**\n * Access the accordion.\n */\n protected readonly accordion = injectAccordionState<NgpAccordion<T>>();\n\n /**\n * The value of the accordion item.\n */\n readonly value = input<T>(uniqueId('ngp-accordion-item') as T, {\n alias: 'ngpAccordionItemValue',\n });\n\n /**\n * Whether the accordion item is disabled.\n */\n readonly disabled = input<boolean, BooleanInput>(false, {\n alias: 'ngpAccordionItemDisabled',\n transform: booleanAttribute,\n });\n\n /**\n * Access the accordion trigger\n * @internal\n */\n readonly trigger = signal<NgpAccordionTrigger<T> | undefined>(undefined);\n\n /**\n * Access the accordion content\n * @internal\n */\n readonly content = signal<NgpAccordionContent<T> | undefined>(undefined);\n\n /**\n * Whether the accordion item is expanded.\n */\n readonly open = computed<boolean>(() => this.accordion().isOpen(this.state.value()!));\n\n /**\n * The trigger id.\n */\n readonly triggerId = computed(() => this.trigger()?.id());\n\n /**\n * The content id.\n */\n readonly contentId = computed(() => this.content()?.id());\n\n /**\n * The accordion item state.\n */\n private readonly state = accordionItemState<NgpAccordionItem<T>>(this);\n}\n","import { Directive, HOST_TAG_NAME, HostListener, inject, input } from '@angular/core';\nimport { uniqueId } from 'ng-primitives/utils';\nimport { NgpAccordionItem } from '../accordion-item/accordion-item';\nimport { injectAccordionItemState } from '../accordion-item/accordion-item-state';\nimport { NgpAccordion } from '../accordion/accordion';\nimport { injectAccordionState } from '../accordion/accordion-state';\n\n/**\n * Apply the `ngpAccordionTrigger` directive to an element that represents the trigger for an accordion item, such as a button.\n */\n@Directive({\n selector: '[ngpAccordionTrigger]',\n exportAs: 'ngpAccordionTrigger',\n host: {\n '[id]': 'id()',\n '[attr.type]': 'tagName === \"button\" ? \"button\" : null',\n '[attr.data-orientation]': 'accordion().orientation()',\n '[attr.data-open]': 'accordionItem().open() ? \"\" : null',\n '[attr.data-disabled]': 'accordionItem().disabled() || accordion().disabled() ? \"\" : null',\n '[attr.aria-controls]': 'accordionItem().contentId()',\n '[attr.aria-expanded]': 'accordionItem().open()',\n },\n})\nexport class NgpAccordionTrigger<T> {\n /**\n * The tag name of the element.\n */\n protected readonly tagName = inject(HOST_TAG_NAME);\n\n /**\n * Access the parent accordion.\n */\n protected readonly accordion = injectAccordionState<NgpAccordion<T>>();\n\n /**\n * The item instance.\n */\n protected readonly accordionItem = injectAccordionItemState<NgpAccordionItem<T>>();\n\n /**\n * The id of the trigger.\n */\n readonly id = input<string>(uniqueId('ngp-accordion-trigger'));\n\n constructor() {\n this.accordionItem().trigger.set(this);\n }\n\n /**\n * Toggle the accordion item.\n */\n @HostListener('click')\n toggle(): void {\n if (this.accordionItem().disabled() || this.accordion().disabled()) {\n return;\n }\n\n this.accordion().toggle(this.accordionItem().value()!);\n }\n}\n","import { InjectionToken, Provider, inject } from '@angular/core';\nimport { NgpAccordionType } from '../accordion/accordion';\n\nexport interface NgpAccordionConfig {\n /**\n * The default type of the accordion\n * @default 'single'\n */\n type: NgpAccordionType;\n /**\n * Whether the accordion is collapsible\n * @default false\n */\n collapsible: boolean;\n /**\n * The default orientation of the accordion\n * @default 'vertical'\n */\n orientation: 'vertical' | 'horizontal';\n}\n\nexport const defaultAccordionConfig: NgpAccordionConfig = {\n type: 'single',\n collapsible: false,\n orientation: 'vertical',\n};\n\nexport const NgpAccordionConfigToken = new InjectionToken<NgpAccordionConfig>(\n 'NgpAccordionConfigToken',\n);\n\n/**\n * Provide the default Accordion configuration\n * @param config The Accordion configuration\n * @returns The provider\n */\nexport function provideAccordionConfig(config: Partial<NgpAccordionConfig>): Provider[] {\n return [\n {\n provide: NgpAccordionConfigToken,\n useValue: { ...defaultAccordionConfig, ...config },\n },\n ];\n}\n\n/**\n * Inject the Accordion configuration\n * @returns The global Accordion configuration\n */\nexport function injectAccordionConfig(): NgpAccordionConfig {\n return inject(NgpAccordionConfigToken, { optional: true }) ?? defaultAccordionConfig;\n}\n","import { BooleanInput } from '@angular/cdk/coercion';\nimport { Directive, booleanAttribute, input, output } from '@angular/core';\nimport { NgpOrientation } from 'ng-primitives/common';\nimport { injectAccordionConfig } from '../config/accordion-config';\nimport { accordionState, provideAccordionState } from './accordion-state';\n\n/**\n * Apply the `ngpAccordion` directive to an element that represents the group of accordion items.\n */\n@Directive({\n selector: '[ngpAccordion]',\n exportAs: 'ngpAccordion',\n providers: [provideAccordionState()],\n host: {\n '[attr.data-orientation]': 'state.orientation()',\n '[attr.data-disabled]': 'state.disabled() ? \"\" : null',\n },\n})\nexport class NgpAccordion<T> {\n /**\n * Access the global accordion configuration.\n */\n private readonly config = injectAccordionConfig();\n\n /**\n * The type of the accordion.\n */\n readonly type = input<NgpAccordionType>(this.config.type, {\n alias: 'ngpAccordionType',\n });\n\n /**\n * Whether the accordion is collapsible.\n */\n readonly collapsible = input<boolean, BooleanInput>(this.config.collapsible, {\n alias: 'ngpAccordionCollapsible',\n transform: booleanAttribute,\n });\n\n /**\n * The value of the accordion.\n */\n readonly value = input<T | T[] | null>(null, {\n alias: 'ngpAccordionValue',\n });\n\n /**\n * Event emitted when the accordion value changes.\n */\n readonly valueChange = output<T | T[] | null>({\n alias: 'ngpAccordionValueChange',\n });\n\n /**\n * Whether the accordion is disabled.\n */\n readonly disabled = input<boolean, BooleanInput>(false, {\n alias: 'ngpAccordionDisabled',\n transform: booleanAttribute,\n });\n\n /**\n * The accordion orientation.\n */\n readonly orientation = input<NgpOrientation>(this.config.orientation, {\n alias: 'ngpAccordionOrientation',\n });\n\n /**\n * The accordion state.\n */\n private readonly state = accordionState<NgpAccordion<T>>(this);\n\n /**\n * @param value The value to check.\n * @returns Whether the value is open.\n * @internal\n */\n isOpen(value: T): boolean {\n if (this.state.type() === 'multiple') {\n return (this.state.value() as T[] | null)?.includes(value) ?? false;\n }\n\n return this.state.value() === value;\n }\n\n toggle(value: T): void {\n const isOpen = this.isOpen(value);\n\n // if we are in single mode and the value is already open and the accordion is not collapsible, do nothing\n if (this.state.type() === 'single' && isOpen && !this.state.collapsible()) {\n return;\n }\n\n // if we are in single mode then toggle the value\n if (this.state.type() === 'single') {\n const newValue = isOpen ? null : value;\n this.state.value.set(newValue);\n this.valueChange.emit(newValue);\n return;\n }\n\n // if we are in multiple mode then toggle the value\n let values = (this.state.value() as T[]) ?? [];\n\n if (isOpen) {\n values = values.filter(v => v !== value);\n } else {\n values = [...values, value];\n }\n this.state.value.set(values);\n this.valueChange.emit(values);\n }\n}\n\nexport type NgpAccordionType = 'single' | 'multiple';\n","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iBAAA;;;ACjBD;;AAEG;;;;"}
@@ -1,10 +1,35 @@
1
1
  import * as i0 from '@angular/core';
2
- import { InjectionToken, inject, TemplateRef, ViewContainerRef, Injector, Directive, contentChild, computed, ElementRef, HostListener, input, booleanAttribute, output, signal, afterNextRender } from '@angular/core';
2
+ import { InjectionToken, inject, TemplateRef, ViewContainerRef, Injector, Directive, contentChild, computed, ElementRef, HostListener, input, numberAttribute, booleanAttribute, output, signal, afterNextRender } from '@angular/core';
3
3
  import { createStateToken, createStateProvider, createStateInjector, createState } from 'ng-primitives/state';
4
4
  import { FocusMonitor } from '@angular/cdk/a11y';
5
5
  import { injectDateAdapter } from 'ng-primitives/date-time';
6
- import { setupButton } from 'ng-primitives/internal';
7
- import { uniqueId, onChange } from 'ng-primitives/utils';
6
+ import { setupButton, explicitEffect } from 'ng-primitives/internal';
7
+ import { uniqueId } from 'ng-primitives/utils';
8
+
9
+ const defaultDatePickerConfig = {
10
+ firstDayOfWeek: 7,
11
+ };
12
+ const NgpDatePickerConfigToken = new InjectionToken('NgpDatePickerConfigToken');
13
+ /**
14
+ * Provide the default DatePicker / DateRangePicker configuration
15
+ * @param config The DatePicker / DateRangePicker configuration
16
+ * @returns The provider
17
+ */
18
+ function provideDatePickerConfig(config) {
19
+ return [
20
+ {
21
+ provide: NgpDatePickerConfigToken,
22
+ useValue: { ...defaultDatePickerConfig, ...config },
23
+ },
24
+ ];
25
+ }
26
+ /**
27
+ * Inject the DatePicker / DateRangePicker configuration
28
+ * @returns The global DatePicker / DateRangePicker configuration
29
+ */
30
+ function injectDatePickerConfig() {
31
+ return inject(NgpDatePickerConfigToken, { optional: true }) ?? defaultDatePickerConfig;
32
+ }
8
33
 
9
34
  const NgpDatePickerRowRenderToken = new InjectionToken('NgpDatePickerRowRenderToken');
10
35
  /**
@@ -689,6 +714,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.11", ngImpo
689
714
  args: ['click']
690
715
  }] } });
691
716
 
717
+ /**
718
+ * The number of days in a week.
719
+ * @internal
720
+ */
721
+ const DAYS_PER_WEEK = 7;
692
722
  /**
693
723
  * A structural directive that renders a row of weekdays in the date picker grid.
694
724
  */
@@ -720,9 +750,11 @@ class NgpDatePickerRowRender {
720
750
  // Get the first and last day of the month.
721
751
  let firstDay = this.dateAdapter.startOfMonth(month);
722
752
  let lastDay = this.dateAdapter.endOfMonth(month);
753
+ // calculate the offset of the first day of the week.
754
+ const firstDayOfWeekOffset = this.getFirstDayOfWeekOffset(firstDay);
723
755
  // find the first and last day of visible in the grid.
724
756
  firstDay = this.dateAdapter.subtract(firstDay, {
725
- days: this.dateAdapter.getDay(firstDay),
757
+ days: firstDayOfWeekOffset,
726
758
  });
727
759
  lastDay = this.dateAdapter.add(lastDay, {
728
760
  days: 6 - this.dateAdapter.getDay(lastDay),
@@ -747,12 +779,12 @@ class NgpDatePickerRowRender {
747
779
  * Store the embedded view refs of each rendered row.
748
780
  */
749
781
  this.viewRefs = [];
750
- // re-render the rows when the month changes.
751
- onChange(this.state().focusedDate, (date, previousDate) => {
752
- if (!date || !previousDate || !this.dateAdapter.isSameMonth(date, previousDate)) {
753
- this.renderRows();
754
- }
755
- });
782
+ /**
783
+ * Store the previously rendered month.
784
+ */
785
+ this.previousMonth = null;
786
+ // Wait for the inputs of the containing picker to be initialized.
787
+ explicitEffect([this.state().focusedDate, this.state().firstDayOfWeek], () => this.renderRows());
756
788
  }
757
789
  ngOnDestroy() {
758
790
  this.destroyRows();
@@ -761,6 +793,13 @@ class NgpDatePickerRowRender {
761
793
  * Render the row.
762
794
  */
763
795
  renderRows() {
796
+ // If the focused date has not changed, do not re-render.
797
+ if (this.previousMonth &&
798
+ this.dateAdapter.isSameMonth(this.previousMonth, this.state().focusedDate())) {
799
+ return;
800
+ }
801
+ // Store the current focused month.
802
+ this.previousMonth = this.state().focusedDate();
764
803
  const weeks = this.weeks();
765
804
  // clear the view container.
766
805
  this.destroyRows();
@@ -783,6 +822,17 @@ class NgpDatePickerRowRender {
783
822
  viewRef.destroy();
784
823
  }
785
824
  }
825
+ /**
826
+ * Get the offset of the first day of the week.
827
+ * @param firstCalendarDay The first day of the calendar without the offset.
828
+ * @returns The offset of the first day of the week.
829
+ *
830
+ * @internal
831
+ */
832
+ getFirstDayOfWeekOffset(firstCalendarDay) {
833
+ return ((DAYS_PER_WEEK + this.dateAdapter.getDay(firstCalendarDay) - this.state().firstDayOfWeek()) %
834
+ DAYS_PER_WEEK);
835
+ }
786
836
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.11", ngImport: i0, type: NgpDatePickerRowRender, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
787
837
  static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.11", type: NgpDatePickerRowRender, isStandalone: true, selector: "[ngpDatePickerRowRender]", providers: [{ provide: NgpDatePickerRowRenderToken, useExisting: NgpDatePickerRowRender }], exportAs: ["ngpDatePickerRowRender"], ngImport: i0 }); }
788
838
  }
@@ -795,6 +845,19 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.11", ngImpo
795
845
  }]
796
846
  }], ctorParameters: () => [] });
797
847
 
848
+ /**
849
+ * Transform the first day of the week input value to a number (0-7) for the start of the week in
850
+ * the calendar.
851
+ * @param firstDayOfWeek The first day of the week input value (number).
852
+ * @returns The first day of the week number.
853
+ */
854
+ function transformToFirstDayOfWeekNumber(firstDayOfWeek) {
855
+ if (!firstDayOfWeek) {
856
+ return 7;
857
+ }
858
+ return numberAttribute(firstDayOfWeek);
859
+ }
860
+
798
861
  /**
799
862
  * The outermost container for the date picker.
800
863
  */
@@ -804,6 +867,10 @@ class NgpDatePicker {
804
867
  * Access the date adapter.
805
868
  */
806
869
  this.dateAdapter = injectDateAdapter();
870
+ /**
871
+ * Access the date picker config.
872
+ */
873
+ this.config = injectDatePickerConfig();
807
874
  /**
808
875
  * Access the injector.
809
876
  */
@@ -833,6 +900,17 @@ class NgpDatePicker {
833
900
  this.dateDisabled = input(() => false, {
834
901
  alias: 'ngpDatePickerDateDisabled',
835
902
  });
903
+ /**
904
+ * Sets which day starts the week in the calendar.
905
+ * Accepts 0-7 where 1=Monday, 2=Tuesday, 3=Wednesday, 4=Thursday, 5=Friday, 6=Saturday, 7=Sunday.
906
+ * Defaults to NgpDatePickerConfig.firstDayOfWeek (default 7 if not overridden).
907
+ * Note: Update calendar header column order when changing from Sunday start.
908
+ * @default 7 (Sunday)
909
+ */
910
+ this.firstDayOfWeek = input(transformToFirstDayOfWeekNumber(this.config.firstDayOfWeek), {
911
+ alias: 'ngpDatePickerFirstDayOfWeek',
912
+ transform: transformToFirstDayOfWeekNumber,
913
+ });
836
914
  /**
837
915
  * The selected value.
838
916
  */
@@ -974,7 +1052,7 @@ class NgpDatePicker {
974
1052
  return false;
975
1053
  }
976
1054
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.11", ngImport: i0, type: NgpDatePicker, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
977
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "19.2.11", type: NgpDatePicker, isStandalone: true, selector: "[ngpDatePicker]", inputs: { min: { classPropertyName: "min", publicName: "ngpDatePickerMin", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "ngpDatePickerMax", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "ngpDatePickerDisabled", isSignal: true, isRequired: false, transformFunction: null }, dateDisabled: { classPropertyName: "dateDisabled", publicName: "ngpDatePickerDateDisabled", isSignal: true, isRequired: false, transformFunction: null }, date: { classPropertyName: "date", publicName: "ngpDatePickerDate", isSignal: true, isRequired: false, transformFunction: null }, focusedDate: { classPropertyName: "focusedDate", publicName: "ngpDatePickerFocusedDate", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { dateChange: "ngpDatePickerDateChange", focusedDateChange: "ngpDatePickerFocusedDateChange" }, host: { properties: { "attr.data-disabled": "state.disabled() ? \"\" : null" } }, providers: [provideDatePickerState()], queries: [{ propertyName: "label", first: true, predicate: NgpDatePickerLabelToken, descendants: true, isSignal: true }], exportAs: ["ngpDatePicker"], ngImport: i0 }); }
1055
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "19.2.11", type: NgpDatePicker, isStandalone: true, selector: "[ngpDatePicker]", inputs: { min: { classPropertyName: "min", publicName: "ngpDatePickerMin", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "ngpDatePickerMax", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "ngpDatePickerDisabled", isSignal: true, isRequired: false, transformFunction: null }, dateDisabled: { classPropertyName: "dateDisabled", publicName: "ngpDatePickerDateDisabled", isSignal: true, isRequired: false, transformFunction: null }, firstDayOfWeek: { classPropertyName: "firstDayOfWeek", publicName: "ngpDatePickerFirstDayOfWeek", isSignal: true, isRequired: false, transformFunction: null }, date: { classPropertyName: "date", publicName: "ngpDatePickerDate", isSignal: true, isRequired: false, transformFunction: null }, focusedDate: { classPropertyName: "focusedDate", publicName: "ngpDatePickerFocusedDate", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { dateChange: "ngpDatePickerDateChange", focusedDateChange: "ngpDatePickerFocusedDateChange" }, host: { properties: { "attr.data-disabled": "state.disabled() ? \"\" : null" } }, providers: [provideDatePickerState()], queries: [{ propertyName: "label", first: true, predicate: NgpDatePickerLabelToken, descendants: true, isSignal: true }], exportAs: ["ngpDatePicker"], ngImport: i0 }); }
978
1056
  }
979
1057
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.11", ngImport: i0, type: NgpDatePicker, decorators: [{
980
1058
  type: Directive,
@@ -991,6 +1069,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.11", ngImpo
991
1069
  class NgpDateRangePicker {
992
1070
  constructor() {
993
1071
  this.dateAdapter = injectDateAdapter();
1072
+ /**
1073
+ * Access the date range picker config.
1074
+ */
1075
+ this.config = injectDatePickerConfig();
994
1076
  /**
995
1077
  * Access the injector.
996
1078
  */
@@ -1020,6 +1102,17 @@ class NgpDateRangePicker {
1020
1102
  this.dateDisabled = input(() => false, {
1021
1103
  alias: 'ngpDateRangePickerDateDisabled',
1022
1104
  });
1105
+ /**
1106
+ * Sets which day starts the week in the calendar.
1107
+ * Accepts 0-7 where 1=Monday, 2=Tuesday, 3=Wednesday, 4=Thursday, 5=Friday, 6=Saturday, 7=Sunday.
1108
+ * Defaults to NgpDatePickerConfig.firstDayOfWeek (default 7 if not overridden).
1109
+ * Note: Update calendar header column order when changing from Sunday start.
1110
+ * @default 7 (Sunday)
1111
+ */
1112
+ this.firstDayOfWeek = input(transformToFirstDayOfWeekNumber(this.config.firstDayOfWeek), {
1113
+ alias: 'ngpDateRangePickerFirstDayOfWeek',
1114
+ transform: transformToFirstDayOfWeekNumber,
1115
+ });
1023
1116
  /**
1024
1117
  * The selected start date
1025
1118
  */
@@ -1218,7 +1311,7 @@ class NgpDateRangePicker {
1218
1311
  return this.dateAdapter.isAfter(date, start) && this.dateAdapter.isBefore(date, end);
1219
1312
  }
1220
1313
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.11", ngImport: i0, type: NgpDateRangePicker, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
1221
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "19.2.11", type: NgpDateRangePicker, isStandalone: true, selector: "[ngpDateRangePicker]", inputs: { min: { classPropertyName: "min", publicName: "ngpDateRangePickerMin", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "ngpDateRangePickerMax", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "ngpDateRangePickerDisabled", isSignal: true, isRequired: false, transformFunction: null }, dateDisabled: { classPropertyName: "dateDisabled", publicName: "ngpDateRangePickerDateDisabled", isSignal: true, isRequired: false, transformFunction: null }, startDate: { classPropertyName: "startDate", publicName: "ngpDateRangePickerStartDate", isSignal: true, isRequired: false, transformFunction: null }, endDate: { classPropertyName: "endDate", publicName: "ngpDateRangePickerEndDate", isSignal: true, isRequired: false, transformFunction: null }, focusedDate: { classPropertyName: "focusedDate", publicName: "ngpDateRangePickerFocusedDate", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { startDateChange: "ngpDateRangePickerStartDateChange", endDateChange: "ngpDateRangePickerEndDateChange", focusedDateChange: "ngpDateRangePickerFocusedDateChange" }, host: { properties: { "attr.data-disabled": "state.disabled() ? \"\" : null" } }, providers: [provideDateRangePickerState()], queries: [{ propertyName: "label", first: true, predicate: NgpDatePickerLabelToken, descendants: true, isSignal: true }], exportAs: ["ngpDateRangePicker"], ngImport: i0 }); }
1314
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "19.2.11", type: NgpDateRangePicker, isStandalone: true, selector: "[ngpDateRangePicker]", inputs: { min: { classPropertyName: "min", publicName: "ngpDateRangePickerMin", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "ngpDateRangePickerMax", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "ngpDateRangePickerDisabled", isSignal: true, isRequired: false, transformFunction: null }, dateDisabled: { classPropertyName: "dateDisabled", publicName: "ngpDateRangePickerDateDisabled", isSignal: true, isRequired: false, transformFunction: null }, firstDayOfWeek: { classPropertyName: "firstDayOfWeek", publicName: "ngpDateRangePickerFirstDayOfWeek", isSignal: true, isRequired: false, transformFunction: null }, startDate: { classPropertyName: "startDate", publicName: "ngpDateRangePickerStartDate", isSignal: true, isRequired: false, transformFunction: null }, endDate: { classPropertyName: "endDate", publicName: "ngpDateRangePickerEndDate", isSignal: true, isRequired: false, transformFunction: null }, focusedDate: { classPropertyName: "focusedDate", publicName: "ngpDateRangePickerFocusedDate", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { startDateChange: "ngpDateRangePickerStartDateChange", endDateChange: "ngpDateRangePickerEndDateChange", focusedDateChange: "ngpDateRangePickerFocusedDateChange" }, host: { properties: { "attr.data-disabled": "state.disabled() ? \"\" : null" } }, providers: [provideDateRangePickerState()], queries: [{ propertyName: "label", first: true, predicate: NgpDatePickerLabelToken, descendants: true, isSignal: true }], exportAs: ["ngpDateRangePicker"], ngImport: i0 }); }
1222
1315
  }
1223
1316
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.11", ngImport: i0, type: NgpDateRangePicker, decorators: [{
1224
1317
  type: Directive,
@@ -1236,5 +1329,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.11", ngImpo
1236
1329
  * Generated bundle index. Do not edit.
1237
1330
  */
1238
1331
 
1239
- export { NgpDatePicker, NgpDatePickerCell, NgpDatePickerCellRender, NgpDatePickerCellRenderToken, NgpDatePickerDateButton, NgpDatePickerDateButtonToken, NgpDatePickerGrid, NgpDatePickerLabel, NgpDatePickerLabelToken, NgpDatePickerNextMonth, NgpDatePickerPreviousMonth, NgpDatePickerRowRender, NgpDatePickerRowRenderToken, NgpDateRangePicker, injectDatePickerCellDate, injectDatePickerCellRender, injectDatePickerDateButton, injectDatePickerLabel, injectDatePickerRowRender, injectDatePickerState, injectDatePickerWeek, injectDateRangePickerState, provideDatePickerState, provideDateRangePickerState };
1332
+ export { NgpDatePicker, NgpDatePickerCell, NgpDatePickerCellRender, NgpDatePickerCellRenderToken, NgpDatePickerDateButton, NgpDatePickerDateButtonToken, NgpDatePickerGrid, NgpDatePickerLabel, NgpDatePickerLabelToken, NgpDatePickerNextMonth, NgpDatePickerPreviousMonth, NgpDatePickerRowRender, NgpDatePickerRowRenderToken, NgpDateRangePicker, injectDatePickerCellDate, injectDatePickerCellRender, injectDatePickerConfig, injectDatePickerDateButton, injectDatePickerLabel, injectDatePickerRowRender, injectDatePickerState, injectDatePickerWeek, injectDateRangePickerState, provideDatePickerConfig, provideDatePickerState, provideDateRangePickerState, transformToFirstDayOfWeekNumber };
1240
1333
  //# sourceMappingURL=ng-primitives-date-picker.mjs.map