@sebgroup/green-angular 1.0.0-beta.9 → 1.0.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.
Files changed (58) hide show
  1. package/esm2020/index.mjs +9 -7
  2. package/esm2020/lib/accordion/accordion-list-item.component.mjs +47 -0
  3. package/esm2020/lib/accordion/accordion.component.mjs +72 -0
  4. package/esm2020/lib/accordion/accordion.module.mjs +19 -0
  5. package/esm2020/lib/accordion/index.mjs +4 -0
  6. package/esm2020/lib/badge/badge.component.mjs +80 -0
  7. package/esm2020/lib/badge/badge.module.mjs +18 -0
  8. package/esm2020/lib/badge/index.mjs +3 -0
  9. package/esm2020/lib/button/button.component.mjs +26 -0
  10. package/esm2020/lib/button/button.module.mjs +18 -0
  11. package/esm2020/lib/button/index.mjs +3 -0
  12. package/esm2020/lib/datepicker/datepicker.component.mjs +86 -26
  13. package/esm2020/lib/datepicker/datepicker.module.mjs +4 -4
  14. package/esm2020/lib/datepicker/index.mjs +3 -0
  15. package/esm2020/lib/dropdown/dropdown-option.directive.mjs +16 -0
  16. package/esm2020/lib/dropdown/dropdown.component.mjs +88 -189
  17. package/esm2020/lib/dropdown/dropdown.module.mjs +8 -7
  18. package/esm2020/lib/dropdown/index.mjs +4 -0
  19. package/esm2020/lib/green-angular.module.mjs +36 -8
  20. package/esm2020/lib/modal/index.mjs +3 -0
  21. package/esm2020/lib/modal/modal.component.mjs +196 -0
  22. package/esm2020/lib/modal/modal.module.mjs +31 -0
  23. package/esm2020/lib/progress-circle/index.mjs +3 -0
  24. package/esm2020/lib/progress-circle/progress-circle.component.mjs +48 -0
  25. package/esm2020/lib/progress-circle/progress-circle.module.mjs +18 -0
  26. package/esm2020/lib/segmented-control/index.mjs +3 -0
  27. package/esm2020/lib/segmented-control/segmented-control.component.mjs +3 -3
  28. package/esm2020/lib/segmented-control/segmented-control.module.mjs +4 -4
  29. package/fesm2015/sebgroup-green-angular.mjs +813 -277
  30. package/fesm2015/sebgroup-green-angular.mjs.map +1 -1
  31. package/fesm2020/sebgroup-green-angular.mjs +799 -272
  32. package/fesm2020/sebgroup-green-angular.mjs.map +1 -1
  33. package/index.d.ts +8 -6
  34. package/lib/accordion/accordion-list-item.component.d.ts +15 -0
  35. package/lib/accordion/accordion.component.d.ts +16 -0
  36. package/lib/accordion/accordion.module.d.ts +9 -0
  37. package/lib/accordion/index.d.ts +3 -0
  38. package/lib/badge/badge.component.d.ts +25 -0
  39. package/lib/badge/badge.module.d.ts +8 -0
  40. package/lib/badge/index.d.ts +2 -0
  41. package/lib/button/button.component.d.ts +9 -0
  42. package/lib/button/button.module.d.ts +8 -0
  43. package/lib/button/index.d.ts +2 -0
  44. package/lib/datepicker/datepicker.component.d.ts +18 -12
  45. package/lib/datepicker/index.d.ts +2 -0
  46. package/lib/dropdown/dropdown-option.directive.d.ts +8 -0
  47. package/lib/dropdown/dropdown.component.d.ts +34 -16
  48. package/lib/dropdown/dropdown.module.d.ts +3 -2
  49. package/lib/dropdown/index.d.ts +3 -0
  50. package/lib/green-angular.module.d.ts +9 -4
  51. package/lib/modal/index.d.ts +2 -0
  52. package/lib/modal/modal.component.d.ts +59 -0
  53. package/lib/modal/modal.module.d.ts +9 -0
  54. package/lib/progress-circle/index.d.ts +2 -0
  55. package/lib/progress-circle/progress-circle.component.d.ts +15 -0
  56. package/lib/progress-circle/progress-circle.module.d.ts +8 -0
  57. package/lib/segmented-control/index.d.ts +2 -0
  58. package/package.json +10 -9
@@ -1,96 +1,296 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Component, ChangeDetectionStrategy, Input, NgModule, EventEmitter, Output, ViewChild } from '@angular/core';
3
- import * as i1 from '@angular/common';
2
+ import { EventEmitter, Component, Input, Output, ContentChildren, NgModule, ChangeDetectionStrategy, HostBinding, Directive, Injector, Inject, ViewChild, ContentChild } from '@angular/core';
3
+ import * as i2 from '@angular/common';
4
4
  import { CommonModule } from '@angular/common';
5
- import * as i2 from '@angular/router';
5
+ import { randomId, dropdownValues, createDropdown, months, years, createDatepicker } from '@sebgroup/extract';
6
+ import { NgControl, NG_VALUE_ACCESSOR } from '@angular/forms';
7
+ import { startOfDay, endOfDay } from 'date-fns';
8
+ import * as i1 from '@angular/cdk/a11y';
9
+ import { A11yModule } from '@angular/cdk/a11y';
10
+ import { disableBodyScroll, enableBodyScroll } from 'body-scroll-lock';
11
+ import * as i2$1 from '@angular/router';
6
12
  import { RouterModule } from '@angular/router';
7
- import { NG_VALUE_ACCESSOR } from '@angular/forms';
8
- import { dropdownValues, createDropdown, randomId, months, years, createDatepicker } from '@sebgroup/extract';
9
13
 
10
- class NggSegmentedControlComponent {
14
+ class NggAccordionListItemComponent {
15
+ constructor() {
16
+ this.id = randomId();
17
+ this.listItemHeader = '';
18
+ this.listItemSubHeader = '';
19
+ this.expandedChange = new EventEmitter();
20
+ this.contentHeight = "0px";
21
+ this.isExpanded = false;
22
+ }
23
+ shrink() {
24
+ this.isExpanded = false;
25
+ this.contentHeight = "0px";
26
+ }
27
+ expand() {
28
+ this.isExpanded = true;
29
+ this.contentHeight = "auto";
30
+ }
31
+ toggleExpanded() {
32
+ this.isExpanded = !this.isExpanded;
33
+ if (this.isExpanded) {
34
+ this.contentHeight = "auto";
35
+ }
36
+ else {
37
+ this.contentHeight = "0px";
38
+ }
39
+ this.expandedChange.emit(this);
40
+ }
11
41
  }
12
- NggSegmentedControlComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: NggSegmentedControlComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
13
- NggSegmentedControlComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.2", type: NggSegmentedControlComponent, selector: "ngg-segmented-control", inputs: { $controls: "$controls" }, ngImport: i0, template: `
14
- <div class="group">
15
- <a
16
- *ngFor="let control of $controls | async"
17
- [routerLink]="control.url"
18
- routerLinkActive="active"
19
- class="button"
20
- >{{ control.text }}</a
21
- >
22
- </div>
23
- `, isInline: true, directives: [{ type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i2.RouterLinkWithHref, selector: "a[routerLink],area[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "preserveFragment", "skipLocationChange", "replaceUrl", "state", "relativeTo", "routerLink"] }, { type: i2.RouterLinkActive, selector: "[routerLinkActive]", inputs: ["routerLinkActiveOptions", "routerLinkActive"], outputs: ["isActiveChange"], exportAs: ["routerLinkActive"] }], pipes: { "async": i1.AsyncPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush });
24
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: NggSegmentedControlComponent, decorators: [{
42
+ NggAccordionListItemComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggAccordionListItemComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
43
+ NggAccordionListItemComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.3", type: NggAccordionListItemComponent, selector: "div[ngg-accordion-list-item]", inputs: { id: "id", listItemHeader: "listItemHeader", listItemSubHeader: "listItemSubHeader" }, outputs: { expandedChange: "expandedChange" }, ngImport: i0, template: "<ng-container data-testid=\"accordion-list-item-root\">\n <div role=\"heading\" aria-level=\"2\" [attr.id]=\"id\">\n <button data-testid=\"accordion-list-item-expander-button\" [attr.id]=\"id + '_header'\" (click)=\"toggleExpanded()\"\n tabindex=\"0\" [attr.aria-expanded]=\"this.isExpanded\" [attr.aria-controls]=\"id + '_section'\">\n <span data-testid=\"accordion-list-item-header\">{{listItemHeader}}</span>\n <span data-testid=\"accordion-list-item-subheader\">{{listItemSubHeader}}</span>\n <svg width=\"1em\" height=\"1em\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n d=\"M18.8095 9.22817L18.1907 8.60942C18.0438 8.46255 17.8063 8.46255 17.6595 8.60942L12.0001 14.2563L6.34072 8.60942C6.19385 8.46255 5.95635 8.46255 5.80947 8.60942L5.19072 9.22817C5.04385 9.37505 5.04385 9.61255 5.19072 9.75942L11.7345 16.3032C11.8813 16.45 12.1188 16.45 12.2657 16.3032L18.8095 9.75942C18.9563 9.61255 18.9563 9.37505 18.8095 9.22817Z\"\n fill=\"#333333\" />\n </svg>\n </button>\n <div role=\"region\" [hidden]=\"!this.isExpanded\"\n [ngStyle]=\"{height: this.contentHeight}\" [id]=\"id + '_section'\" [attr.aria-labelledby]=\"id + '_header'\"\n data-testid=\"accordion-list-item-content\">\n <div>\n <ng-content></ng-content>\n </div>\n </div>\n </div>\n</ng-container>", directives: [{ type: i2.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }] });
44
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggAccordionListItemComponent, decorators: [{
45
+ type: Component,
46
+ args: [{ selector: 'div[ngg-accordion-list-item]', template: "<ng-container data-testid=\"accordion-list-item-root\">\n <div role=\"heading\" aria-level=\"2\" [attr.id]=\"id\">\n <button data-testid=\"accordion-list-item-expander-button\" [attr.id]=\"id + '_header'\" (click)=\"toggleExpanded()\"\n tabindex=\"0\" [attr.aria-expanded]=\"this.isExpanded\" [attr.aria-controls]=\"id + '_section'\">\n <span data-testid=\"accordion-list-item-header\">{{listItemHeader}}</span>\n <span data-testid=\"accordion-list-item-subheader\">{{listItemSubHeader}}</span>\n <svg width=\"1em\" height=\"1em\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n d=\"M18.8095 9.22817L18.1907 8.60942C18.0438 8.46255 17.8063 8.46255 17.6595 8.60942L12.0001 14.2563L6.34072 8.60942C6.19385 8.46255 5.95635 8.46255 5.80947 8.60942L5.19072 9.22817C5.04385 9.37505 5.04385 9.61255 5.19072 9.75942L11.7345 16.3032C11.8813 16.45 12.1188 16.45 12.2657 16.3032L18.8095 9.75942C18.9563 9.61255 18.9563 9.37505 18.8095 9.22817Z\"\n fill=\"#333333\" />\n </svg>\n </button>\n <div role=\"region\" [hidden]=\"!this.isExpanded\"\n [ngStyle]=\"{height: this.contentHeight}\" [id]=\"id + '_section'\" [attr.aria-labelledby]=\"id + '_header'\"\n data-testid=\"accordion-list-item-content\">\n <div>\n <ng-content></ng-content>\n </div>\n </div>\n </div>\n</ng-container>" }]
47
+ }], propDecorators: { id: [{
48
+ type: Input
49
+ }], listItemHeader: [{
50
+ type: Input
51
+ }], listItemSubHeader: [{
52
+ type: Input
53
+ }], expandedChange: [{
54
+ type: Output
55
+ }] } });
56
+
57
+ class NggAccordionComponent {
58
+ constructor() {
59
+ this.closeOthers = false;
60
+ }
61
+ get expandAll() {
62
+ return this._expandAll;
63
+ }
64
+ set expandAll(value) {
65
+ if (value === this._expandAll)
66
+ return;
67
+ if (this._expandAll) {
68
+ this.expandAllSubscription?.unsubscribe();
69
+ }
70
+ this._expandAll = value;
71
+ this.expandAllSubscription = this._expandAll?.subscribe(() => {
72
+ if (this.closeOthers === false) {
73
+ const itemArray = this.items ? Array.from(this.items) : undefined;
74
+ if (itemArray) {
75
+ for (const i of itemArray) {
76
+ i.expand();
77
+ }
78
+ }
79
+ }
80
+ });
81
+ }
82
+ ngAfterContentChecked() {
83
+ if (this.closeOthers) {
84
+ const itemArray = this.items ? Array.from(this.items) : undefined;
85
+ if (itemArray) {
86
+ for (const i of itemArray) {
87
+ i.expandedChange.subscribe((child) => this.onChildExpanded(child));
88
+ }
89
+ }
90
+ }
91
+ }
92
+ ngOnDestroy() {
93
+ if (this.closeOthers) {
94
+ const itemArray = this.items ? Array.from(this.items) : undefined;
95
+ if (itemArray) {
96
+ for (const i of itemArray) {
97
+ i.expandedChange.unsubscribe();
98
+ }
99
+ }
100
+ }
101
+ this.expandAllSubscription?.unsubscribe();
102
+ }
103
+ onChildExpanded(childIdentity) {
104
+ if (this.closeOthers && childIdentity.isExpanded && this.items) {
105
+ this.items.forEach((item) => {
106
+ if (item !== childIdentity)
107
+ item.shrink();
108
+ });
109
+ }
110
+ }
111
+ }
112
+ NggAccordionComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggAccordionComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
113
+ NggAccordionComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.3", type: NggAccordionComponent, selector: "ngg-accordion", inputs: { closeOthers: "closeOthers", expandAll: "expandAll" }, queries: [{ propertyName: "items", predicate: NggAccordionListItemComponent }], ngImport: i0, template: "<div class=\"accordion\" data-testid=\"accordion-root\">\n <ng-content></ng-content>\n</div>\n" });
114
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggAccordionComponent, decorators: [{
25
115
  type: Component,
116
+ args: [{ selector: "ngg-accordion", template: "<div class=\"accordion\" data-testid=\"accordion-root\">\n <ng-content></ng-content>\n</div>\n" }]
117
+ }], propDecorators: { items: [{
118
+ type: ContentChildren,
119
+ args: [NggAccordionListItemComponent]
120
+ }], closeOthers: [{
121
+ type: Input
122
+ }], expandAll: [{
123
+ type: Input
124
+ }] } });
125
+
126
+ class NggAccordionModule {
127
+ }
128
+ NggAccordionModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggAccordionModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
129
+ NggAccordionModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggAccordionModule, declarations: [NggAccordionListItemComponent, NggAccordionComponent], imports: [CommonModule], exports: [NggAccordionListItemComponent, NggAccordionComponent] });
130
+ NggAccordionModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggAccordionModule, imports: [[CommonModule]] });
131
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggAccordionModule, decorators: [{
132
+ type: NgModule,
26
133
  args: [{
27
- selector: 'ngg-segmented-control',
134
+ imports: [CommonModule],
135
+ exports: [NggAccordionListItemComponent, NggAccordionComponent],
136
+ declarations: [NggAccordionListItemComponent, NggAccordionComponent]
137
+ }]
138
+ }] });
139
+
140
+ class NggBadgeComponent {
141
+ //eslint-disable-next-line
142
+ constructor() {
143
+ /** The color of the component */
144
+ this.badgeType = '';
145
+ /** Callback when component is dismissed */
146
+ this.handleClose = new EventEmitter();
147
+ }
148
+ /** Flag whether the component can be dismissed */
149
+ set isCloseable(value) {
150
+ this._isCloseable = value;
151
+ }
152
+ get isCloseable() {
153
+ return this._isCloseable === '' || !!this._isCloseable;
154
+ }
155
+ get class() {
156
+ return ['badge', this.badgeType].join(' ');
157
+ }
158
+ ngOnInit() {
159
+ if (!!this.customColor || !!this.customBackgroundColor) {
160
+ this.badgeType = '';
161
+ }
162
+ }
163
+ close(e) {
164
+ this.handleClose.emit(e);
165
+ }
166
+ }
167
+ NggBadgeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggBadgeComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
168
+ NggBadgeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.3", type: NggBadgeComponent, selector: "[ngg-badge]", inputs: { badgeType: "badgeType", isCloseable: "isCloseable", closeText: "closeText", customColor: "customColor", customBackgroundColor: "customBackgroundColor" }, outputs: { handleClose: "handleClose" }, host: { properties: { "style.color": "this.customColor", "style.background-color": "this.customBackgroundColor", "class": "this.class" } }, ngImport: i0, template: `
169
+ <strong>
170
+ <ng-content></ng-content>
171
+ </strong>
172
+ <button *ngIf="isCloseable" class="close" (click)="close($event)">
173
+ {{ closeText }}
174
+ <i></i>
175
+ </button>
176
+ `, isInline: true, directives: [{ type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
177
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggBadgeComponent, decorators: [{
178
+ type: Component,
179
+ args: [{
180
+ // we need to disable this warning since we don't want the badge component to create a new element
181
+ // eslint-disable-next-line @angular-eslint/component-selector
182
+ selector: '[ngg-badge]',
28
183
  template: `
29
- <div class="group">
30
- <a
31
- *ngFor="let control of $controls | async"
32
- [routerLink]="control.url"
33
- routerLinkActive="active"
34
- class="button"
35
- >{{ control.text }}</a
36
- >
37
- </div>
184
+ <strong>
185
+ <ng-content></ng-content>
186
+ </strong>
187
+ <button *ngIf="isCloseable" class="close" (click)="close($event)">
188
+ {{ closeText }}
189
+ <i></i>
190
+ </button>
38
191
  `,
39
- styles: [],
40
192
  changeDetection: ChangeDetectionStrategy.OnPush,
41
193
  }]
42
- }], propDecorators: { $controls: [{
194
+ }], ctorParameters: function () { return []; }, propDecorators: { badgeType: [{
195
+ type: Input
196
+ }], isCloseable: [{
197
+ type: Input
198
+ }], closeText: [{
43
199
  type: Input
200
+ }], customColor: [{
201
+ type: HostBinding,
202
+ args: ['style.color']
203
+ }, {
204
+ type: Input
205
+ }], customBackgroundColor: [{
206
+ type: HostBinding,
207
+ args: ['style.background-color']
208
+ }, {
209
+ type: Input
210
+ }], class: [{
211
+ type: HostBinding,
212
+ args: ['class']
213
+ }], handleClose: [{
214
+ type: Output
44
215
  }] } });
45
216
 
46
- class NggSegmentedControlModule {
217
+ class NggBadgeModule {
47
218
  }
48
- NggSegmentedControlModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: NggSegmentedControlModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
49
- NggSegmentedControlModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: NggSegmentedControlModule, declarations: [NggSegmentedControlComponent], imports: [RouterModule, CommonModule], exports: [NggSegmentedControlComponent] });
50
- NggSegmentedControlModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: NggSegmentedControlModule, imports: [[RouterModule, CommonModule]] });
51
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: NggSegmentedControlModule, decorators: [{
219
+ NggBadgeModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggBadgeModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
220
+ NggBadgeModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggBadgeModule, declarations: [NggBadgeComponent], imports: [CommonModule], exports: [NggBadgeComponent] });
221
+ NggBadgeModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggBadgeModule, imports: [[CommonModule]] });
222
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggBadgeModule, decorators: [{
52
223
  type: NgModule,
53
224
  args: [{
54
- declarations: [NggSegmentedControlComponent],
55
- imports: [RouterModule, CommonModule],
56
- exports: [NggSegmentedControlComponent],
225
+ declarations: [NggBadgeComponent],
226
+ imports: [CommonModule],
227
+ exports: [NggBadgeComponent],
57
228
  }]
58
229
  }] });
59
230
 
231
+ class NggDropdownOptionDirective {
232
+ constructor(templateRef) {
233
+ this.templateRef = templateRef;
234
+ }
235
+ }
236
+ NggDropdownOptionDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggDropdownOptionDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
237
+ NggDropdownOptionDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.3", type: NggDropdownOptionDirective, selector: "[nggDropdownOption]", ngImport: i0 });
238
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggDropdownOptionDirective, decorators: [{
239
+ type: Directive,
240
+ args: [{
241
+ selector: '[nggDropdownOption]',
242
+ }]
243
+ }], ctorParameters: function () { return [{ type: i0.TemplateRef }]; } });
244
+
60
245
  class NggDropdownComponent {
61
- constructor(cd) {
246
+ constructor(cd, injector) {
62
247
  this.cd = cd;
248
+ this.injector = injector;
63
249
  this.loop = false;
64
250
  this.options = [];
251
+ this._multiSelect = false;
252
+ this._searchable = false;
65
253
  this.valueChange = new EventEmitter();
66
- this.toggler = dropdownValues.elements?.toggler;
67
- this.listbox = dropdownValues.elements?.listbox;
254
+ this.touched = new EventEmitter();
255
+ this.toggler = dropdownValues().elements?.toggler;
256
+ this.listbox = dropdownValues().elements?.listbox;
257
+ this.fieldset = dropdownValues().elements?.fieldset;
68
258
  this.trackByKey = (index, option) => {
69
- return option.key;
259
+ return option.attributes.id ?? '';
70
260
  };
71
261
  }
262
+ set multiSelect(value) {
263
+ this._multiSelect = this.convertToBoolean(value);
264
+ }
265
+ get multiSelect() {
266
+ return this._multiSelect;
267
+ }
268
+ set searchable(value) {
269
+ this._searchable = this.convertToBoolean(value);
270
+ }
271
+ get searchable() {
272
+ return this._searchable;
273
+ }
274
+ set value(newValue) {
275
+ this.handler?.selectByValue(newValue);
276
+ this._value = newValue;
277
+ }
72
278
  get value() {
73
279
  return this._value;
74
280
  }
75
- set value(newValue) {
76
- this.setSelectionByValue(newValue);
281
+ get control() {
282
+ return this.injector.get(NgControl);
77
283
  }
78
284
  ngAfterViewInit() {
79
285
  if (this.togglerRef?.nativeElement && this.listboxRef?.nativeElement) {
80
- this.handler = createDropdown(this.props, this.togglerRef.nativeElement, this.listboxRef.nativeElement, (dropdown) => {
286
+ this.handler = createDropdown(this.props, this.togglerRef.nativeElement, this.listboxRef.nativeElement, this.fieldsetRef?.nativeElement, (dropdown) => {
81
287
  this.dropdown = dropdown;
82
288
  this.toggler = dropdown.elements.toggler;
83
289
  this.listbox = dropdown.elements.listbox;
84
- const selected = this.dropdown.options?.find((option) => option.selected);
85
- if (selected && this._value !== selected?.value) {
86
- setTimeout(() => {
87
- this._value = selected.value;
88
- this.valueChange.emit(selected.value);
89
- this.onChangeFn && this.onChangeFn(selected.value);
90
- this.onTouchedFn && this.onTouchedFn();
91
- }, 0);
92
- }
290
+ this.fieldset = dropdown.elements.fieldset;
93
291
  this.cd.detectChanges();
292
+ }, (value) => {
293
+ this.updateValue(value);
94
294
  });
95
295
  }
96
296
  }
@@ -99,7 +299,7 @@ class NggDropdownComponent {
99
299
  }
100
300
  ngOnChanges(changes) {
101
301
  if (this.handler &&
102
- (changes.id || changes.text || changes.loop || changes.options)) {
302
+ (changes.id || changes.texts || changes.loop || changes.options)) {
103
303
  this.handler.update(this.props);
104
304
  }
105
305
  }
@@ -112,201 +312,68 @@ class NggDropdownComponent {
112
312
  registerOnTouched(fn) {
113
313
  this.onTouchedFn = fn;
114
314
  }
115
- select(option) {
116
- this.handler?.select(option);
117
- this._value = option.value;
118
- this.valueChange.emit(option.value);
119
- this.onChangeFn && this.onChangeFn(option.value);
120
- this.onTouchedFn && this.onTouchedFn();
315
+ search($event) {
316
+ this.handler?.search($event.target.value);
121
317
  }
122
318
  get props() {
123
319
  return {
124
320
  id: this.id || this.dropdown?.id,
125
- text: this.text,
321
+ texts: this.texts,
322
+ useValue: this.useValue,
323
+ display: this.display,
126
324
  options: this.options,
127
325
  loop: this.loop,
128
326
  value: this.value,
327
+ multiSelect: this.multiSelect,
328
+ searchable: this.searchable,
329
+ searchFilter: this.searchFilter,
330
+ compareWith: this.compareWith,
331
+ onTouched: () => {
332
+ this.onTouchedFn?.();
333
+ this.touched.emit(true);
334
+ this.cd.markForCheck();
335
+ },
129
336
  };
130
337
  }
131
- setSelectionByValue(value) {
132
- if (this._value !== value) {
133
- this._value = value;
134
- const selected = this.handler?.dropdown?.options.find((option) => option.value === value);
135
- if (selected)
136
- this.handler?.select(selected);
137
- }
338
+ updateValue(option) {
339
+ this._value = option;
340
+ this.valueChange.emit(option);
341
+ this.onChangeFn?.(option);
342
+ }
343
+ convertToBoolean(value) {
344
+ return (value === '' || value === 'true' || value.toString() === 'true' || false);
138
345
  }
139
346
  }
140
- NggDropdownComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: NggDropdownComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
141
- NggDropdownComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.2", type: NggDropdownComponent, selector: "ngg-dropdown", inputs: { id: "id", text: "text", loop: "loop", label: "label", options: "options", valid: "valid", invalid: "invalid", value: "value" }, outputs: { valueChange: "valueChange" }, providers: [
347
+ NggDropdownComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggDropdownComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: Injector }], target: i0.ɵɵFactoryTarget.Component });
348
+ NggDropdownComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.3", type: NggDropdownComponent, selector: "ngg-dropdown", inputs: { id: "id", texts: "texts", loop: "loop", display: "display", useValue: "useValue", label: "label", options: "options", valid: "valid", invalid: "invalid", compareWith: "compareWith", searchFilter: "searchFilter", multiSelect: "multiSelect", searchable: "searchable", value: "value" }, outputs: { valueChange: "valueChange", touched: "touched" }, providers: [
142
349
  {
143
350
  provide: NG_VALUE_ACCESSOR,
144
351
  useExisting: NggDropdownComponent,
145
352
  multi: true,
146
353
  },
147
- ], viewQueries: [{ propertyName: "togglerRef", first: true, predicate: ["togglerRef"], descendants: true }, { propertyName: "listboxRef", first: true, predicate: ["listboxRef"], descendants: true }], usesOnChanges: true, ngImport: i0, template: `
148
- <div>
149
- <span
150
- class="label"
151
- *ngIf="label"
152
- [id]="toggler?.attributes?.id + '_label'"
153
- >{{ label }}</span
154
- >
155
- <button
156
- [attr.aria-labelledby]="
157
- label ? toggler?.attributes?.id + '_label' : null
158
- "
159
- [attr.aria-describedby]="
160
- formInfo?.innerText && formInfo.innerText.length > 0
161
- ? toggler?.attributes?.id + '_info'
162
- : null
163
- "
164
- type="button"
165
- #togglerRef
166
- [id]="toggler?.attributes?.id"
167
- [attr.aria-haspopup]="toggler?.attributes?.['aria-haspopup']"
168
- [attr.aria-expanded]="toggler?.attributes?.['aria-expanded']"
169
- [attr.aria-owns]="toggler?.attributes?.['aria-owns']"
170
- [tabindex]="toggler?.attributes?.tabIndex"
171
- [style]="toggler?.attributes?.style"
172
- [class]="toggler?.classes"
173
- (click)="handler?.toggle()"
174
- [class.is-valid]="valid"
175
- [class.is-invalid]="invalid"
176
- >
177
- <span>{{ dropdown?.text }}</span>
178
- </button>
179
- <span
180
- class="form-info"
181
- #formInfo
182
- [attr.id]="toggler?.attributes?.id + '_info'"
183
- ><ng-content select="[data-form-info]"></ng-content
184
- ></span>
185
- <div
186
- #listboxRef
187
- [id]="listbox?.attributes?.id"
188
- [attr.role]="listbox?.attributes?.role"
189
- [attr.aria-activedescendant]="
190
- listbox?.attributes?.['aria-activedescendant']
191
- "
192
- [tabindex]="listbox?.attributes?.tabIndex"
193
- [style]="listbox?.attributes?.style"
194
- [class]="listbox?.classes"
195
- >
196
- <button
197
- type="button"
198
- class="close m-4 m-sm-2 d-block d-sm-none"
199
- (click)="handler?.close()"
200
- >
201
- <span class="sr-only">Close</span>
202
- </button>
203
- <ul role="listbox">
204
- <li
205
- *ngFor="let option of dropdown?.options; trackBy: trackByKey"
206
- [id]="option.attributes.id"
207
- [attr.role]="option.attributes.role"
208
- [attr.aria-selected]="option.attributes['aria-selected']"
209
- [style]="option.attributes.style"
210
- [class]="option.classes"
211
- (click)="handler?.select(option)"
212
- >
213
- {{ option.key }}
214
- </li>
215
- </ul>
216
- </div>
217
- </div>
218
- `, isInline: true, directives: [{ type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
219
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: NggDropdownComponent, decorators: [{
354
+ ], queries: [{ propertyName: "customOption", first: true, predicate: NggDropdownOptionDirective, descendants: true }], viewQueries: [{ propertyName: "togglerRef", first: true, predicate: ["togglerRef"], descendants: true }, { propertyName: "listboxRef", first: true, predicate: ["listboxRef"], descendants: true }, { propertyName: "fieldsetRef", first: true, predicate: ["fieldsetRef"], descendants: true }], usesOnChanges: true, ngImport: i0, template: "<div>\n <span class=\"label\" *ngIf=\"label\" [id]=\"toggler?.attributes?.id + '_label'\">{{\n label\n }}</span>\n <button\n [attr.aria-labelledby]=\"label ? toggler?.attributes?.id + '_label' : null\"\n [attr.aria-describedby]=\"\n formInfo?.textContent && (formInfo?.textContent?.length ?? 0 > 0)\n ? toggler?.attributes?.id + '_info'\n : null\n \"\n type=\"button\"\n #togglerRef\n [id]=\"toggler?.attributes?.id\"\n [attr.aria-haspopup]=\"toggler?.attributes?.['aria-haspopup']\"\n [attr.aria-expanded]=\"toggler?.attributes?.['aria-expanded']\"\n [attr.aria-owns]=\"toggler?.attributes?.['aria-owns']\"\n [tabindex]=\"toggler?.attributes?.tabIndex\"\n [style]=\"toggler?.attributes?.style\"\n [class]=\"toggler?.classes\"\n (click)=\"handler?.toggle()\"\n [class.is-valid]=\"valid\"\n [class.is-invalid]=\"invalid\"\n >\n <span>{{ dropdown?.texts?.select }}</span>\n </button>\n <span\n class=\"form-info\"\n #formInfo\n [attr.id]=\"toggler?.attributes?.id + '_info'\"\n ><ng-content select=\"[data-form-info]\"></ng-content\n ></span>\n <div\n #listboxRef\n [id]=\"listbox?.attributes?.id\"\n [attr.role]=\"listbox?.attributes?.role\"\n [attr.aria-activedescendant]=\"\n listbox?.attributes?.['aria-activedescendant']\n \"\n [tabindex]=\"listbox?.attributes?.tabIndex\"\n [style]=\"listbox?.attributes?.style\"\n [class]=\"listbox?.classes\"\n >\n <button\n type=\"button\"\n class=\"close m-4 m-sm-2 d-block d-sm-none\"\n (click)=\"handler?.close()\"\n >\n <span class=\"sr-only\">{{ dropdown?.texts?.close }}</span>\n <i></i>\n </button>\n <ul role=\"listbox\" *ngIf=\"!dropdown?.isMultiSelect\">\n <ng-container *ngTemplateOutlet=\"searchInput\"></ng-container>\n <li\n *ngFor=\"\n let option of dropdown?.options;\n let index = index;\n trackBy: trackByKey\n \"\n [id]=\"option.attributes.id\"\n [attr.role]=\"option.attributes.role\"\n [attr.aria-selected]=\"option.attributes['aria-selected']\"\n [style]=\"option.attributes.style\"\n [class]=\"option.classes\"\n (click)=\"handler?.select(option)\"\n >\n <ng-container\n *ngTemplateOutlet=\"\n customOption?.templateRef\n ? customOption!.templateRef\n : defaultOption;\n context: { option: option, index: index }\n \"\n ></ng-container>\n </li>\n </ul>\n <div *ngIf=\"dropdown?.isMultiSelect\" class=\"sg-fieldset-container\">\n <ng-container *ngTemplateOutlet=\"searchInput\"></ng-container>\n <!--TODO: Improve checkboxes in dropdown angular-->\n <fieldset\n #fieldsetRef\n [attr.aria-describedby]=\"fieldset?.attributes?.id\"\n role=\"listbox\"\n tabIndex=\"-1\"\n aria-multiselectable=\"true\"\n >\n <legend class=\"sr-only\" [id]=\"fieldset?.attributes?.id\">Options</legend>\n <div>\n <label\n class=\"form-control\"\n [attr.role]=\"option.attributes.role\"\n [id]=\"option.attributes.id\"\n [attr.aria-selected]=\"option.attributes['aria-selected']\"\n [class]=\"option.classes\"\n *ngFor=\"\n let option of dropdown?.options;\n let index = index;\n trackBy: trackByKey\n \"\n >\n <input\n type=\"checkbox\"\n (change)=\"handler?.select(option, false)\"\n [checked]=\"option.selected\"\n tabIndex=\"-1\"\n />\n <ng-container\n *ngTemplateOutlet=\"\n customOption?.templateRef\n ? customOption!.templateRef\n : defaultOption;\n context: { option: option, index: index }\n \"\n ></ng-container>\n <i></i>\n </label>\n </div>\n </fieldset>\n </div>\n </div>\n</div>\n\n<ng-template #defaultOption let-option=\"option\">\n {{ option[dropdown!.display] }}\n</ng-template>\n\n<ng-template #searchInput>\n <input\n *ngIf=\"dropdown?.isSearchable\"\n [id]=\"toggler?.attributes?.id + '_search-input'\"\n type=\"search\"\n (input)=\"search($event)\"\n placeholder=\"{{ dropdown?.texts?.searchPlaceholder }}\"\n class=\"rounded-0 rounded-top border-0 border-bottom border-info\"\n />\n</ng-template>\n", directives: [{ type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
355
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggDropdownComponent, decorators: [{
220
356
  type: Component,
221
- args: [{
222
- selector: 'ngg-dropdown',
223
- template: `
224
- <div>
225
- <span
226
- class="label"
227
- *ngIf="label"
228
- [id]="toggler?.attributes?.id + '_label'"
229
- >{{ label }}</span
230
- >
231
- <button
232
- [attr.aria-labelledby]="
233
- label ? toggler?.attributes?.id + '_label' : null
234
- "
235
- [attr.aria-describedby]="
236
- formInfo?.innerText && formInfo.innerText.length > 0
237
- ? toggler?.attributes?.id + '_info'
238
- : null
239
- "
240
- type="button"
241
- #togglerRef
242
- [id]="toggler?.attributes?.id"
243
- [attr.aria-haspopup]="toggler?.attributes?.['aria-haspopup']"
244
- [attr.aria-expanded]="toggler?.attributes?.['aria-expanded']"
245
- [attr.aria-owns]="toggler?.attributes?.['aria-owns']"
246
- [tabindex]="toggler?.attributes?.tabIndex"
247
- [style]="toggler?.attributes?.style"
248
- [class]="toggler?.classes"
249
- (click)="handler?.toggle()"
250
- [class.is-valid]="valid"
251
- [class.is-invalid]="invalid"
252
- >
253
- <span>{{ dropdown?.text }}</span>
254
- </button>
255
- <span
256
- class="form-info"
257
- #formInfo
258
- [attr.id]="toggler?.attributes?.id + '_info'"
259
- ><ng-content select="[data-form-info]"></ng-content
260
- ></span>
261
- <div
262
- #listboxRef
263
- [id]="listbox?.attributes?.id"
264
- [attr.role]="listbox?.attributes?.role"
265
- [attr.aria-activedescendant]="
266
- listbox?.attributes?.['aria-activedescendant']
267
- "
268
- [tabindex]="listbox?.attributes?.tabIndex"
269
- [style]="listbox?.attributes?.style"
270
- [class]="listbox?.classes"
271
- >
272
- <button
273
- type="button"
274
- class="close m-4 m-sm-2 d-block d-sm-none"
275
- (click)="handler?.close()"
276
- >
277
- <span class="sr-only">Close</span>
278
- </button>
279
- <ul role="listbox">
280
- <li
281
- *ngFor="let option of dropdown?.options; trackBy: trackByKey"
282
- [id]="option.attributes.id"
283
- [attr.role]="option.attributes.role"
284
- [attr.aria-selected]="option.attributes['aria-selected']"
285
- [style]="option.attributes.style"
286
- [class]="option.classes"
287
- (click)="handler?.select(option)"
288
- >
289
- {{ option.key }}
290
- </li>
291
- </ul>
292
- </div>
293
- </div>
294
- `,
295
- providers: [
357
+ args: [{ selector: 'ngg-dropdown', providers: [
296
358
  {
297
359
  provide: NG_VALUE_ACCESSOR,
298
360
  useExisting: NggDropdownComponent,
299
361
  multi: true,
300
362
  },
301
- ],
302
- changeDetection: ChangeDetectionStrategy.OnPush,
303
- }]
304
- }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { id: [{
363
+ ], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div>\n <span class=\"label\" *ngIf=\"label\" [id]=\"toggler?.attributes?.id + '_label'\">{{\n label\n }}</span>\n <button\n [attr.aria-labelledby]=\"label ? toggler?.attributes?.id + '_label' : null\"\n [attr.aria-describedby]=\"\n formInfo?.textContent && (formInfo?.textContent?.length ?? 0 > 0)\n ? toggler?.attributes?.id + '_info'\n : null\n \"\n type=\"button\"\n #togglerRef\n [id]=\"toggler?.attributes?.id\"\n [attr.aria-haspopup]=\"toggler?.attributes?.['aria-haspopup']\"\n [attr.aria-expanded]=\"toggler?.attributes?.['aria-expanded']\"\n [attr.aria-owns]=\"toggler?.attributes?.['aria-owns']\"\n [tabindex]=\"toggler?.attributes?.tabIndex\"\n [style]=\"toggler?.attributes?.style\"\n [class]=\"toggler?.classes\"\n (click)=\"handler?.toggle()\"\n [class.is-valid]=\"valid\"\n [class.is-invalid]=\"invalid\"\n >\n <span>{{ dropdown?.texts?.select }}</span>\n </button>\n <span\n class=\"form-info\"\n #formInfo\n [attr.id]=\"toggler?.attributes?.id + '_info'\"\n ><ng-content select=\"[data-form-info]\"></ng-content\n ></span>\n <div\n #listboxRef\n [id]=\"listbox?.attributes?.id\"\n [attr.role]=\"listbox?.attributes?.role\"\n [attr.aria-activedescendant]=\"\n listbox?.attributes?.['aria-activedescendant']\n \"\n [tabindex]=\"listbox?.attributes?.tabIndex\"\n [style]=\"listbox?.attributes?.style\"\n [class]=\"listbox?.classes\"\n >\n <button\n type=\"button\"\n class=\"close m-4 m-sm-2 d-block d-sm-none\"\n (click)=\"handler?.close()\"\n >\n <span class=\"sr-only\">{{ dropdown?.texts?.close }}</span>\n <i></i>\n </button>\n <ul role=\"listbox\" *ngIf=\"!dropdown?.isMultiSelect\">\n <ng-container *ngTemplateOutlet=\"searchInput\"></ng-container>\n <li\n *ngFor=\"\n let option of dropdown?.options;\n let index = index;\n trackBy: trackByKey\n \"\n [id]=\"option.attributes.id\"\n [attr.role]=\"option.attributes.role\"\n [attr.aria-selected]=\"option.attributes['aria-selected']\"\n [style]=\"option.attributes.style\"\n [class]=\"option.classes\"\n (click)=\"handler?.select(option)\"\n >\n <ng-container\n *ngTemplateOutlet=\"\n customOption?.templateRef\n ? customOption!.templateRef\n : defaultOption;\n context: { option: option, index: index }\n \"\n ></ng-container>\n </li>\n </ul>\n <div *ngIf=\"dropdown?.isMultiSelect\" class=\"sg-fieldset-container\">\n <ng-container *ngTemplateOutlet=\"searchInput\"></ng-container>\n <!--TODO: Improve checkboxes in dropdown angular-->\n <fieldset\n #fieldsetRef\n [attr.aria-describedby]=\"fieldset?.attributes?.id\"\n role=\"listbox\"\n tabIndex=\"-1\"\n aria-multiselectable=\"true\"\n >\n <legend class=\"sr-only\" [id]=\"fieldset?.attributes?.id\">Options</legend>\n <div>\n <label\n class=\"form-control\"\n [attr.role]=\"option.attributes.role\"\n [id]=\"option.attributes.id\"\n [attr.aria-selected]=\"option.attributes['aria-selected']\"\n [class]=\"option.classes\"\n *ngFor=\"\n let option of dropdown?.options;\n let index = index;\n trackBy: trackByKey\n \"\n >\n <input\n type=\"checkbox\"\n (change)=\"handler?.select(option, false)\"\n [checked]=\"option.selected\"\n tabIndex=\"-1\"\n />\n <ng-container\n *ngTemplateOutlet=\"\n customOption?.templateRef\n ? customOption!.templateRef\n : defaultOption;\n context: { option: option, index: index }\n \"\n ></ng-container>\n <i></i>\n </label>\n </div>\n </fieldset>\n </div>\n </div>\n</div>\n\n<ng-template #defaultOption let-option=\"option\">\n {{ option[dropdown!.display] }}\n</ng-template>\n\n<ng-template #searchInput>\n <input\n *ngIf=\"dropdown?.isSearchable\"\n [id]=\"toggler?.attributes?.id + '_search-input'\"\n type=\"search\"\n (input)=\"search($event)\"\n placeholder=\"{{ dropdown?.texts?.searchPlaceholder }}\"\n class=\"rounded-0 rounded-top border-0 border-bottom border-info\"\n />\n</ng-template>\n" }]
364
+ }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: i0.Injector, decorators: [{
365
+ type: Inject,
366
+ args: [Injector]
367
+ }] }]; }, propDecorators: { id: [{
305
368
  type: Input
306
- }], text: [{
369
+ }], texts: [{
307
370
  type: Input
308
371
  }], loop: [{
309
372
  type: Input
373
+ }], display: [{
374
+ type: Input
375
+ }], useValue: [{
376
+ type: Input
310
377
  }], label: [{
311
378
  type: Input
312
379
  }], options: [{
@@ -315,52 +382,61 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.2", ngImpor
315
382
  type: Input
316
383
  }], invalid: [{
317
384
  type: Input
385
+ }], compareWith: [{
386
+ type: Input
387
+ }], searchFilter: [{
388
+ type: Input
389
+ }], multiSelect: [{
390
+ type: Input
391
+ }], searchable: [{
392
+ type: Input
318
393
  }], value: [{
319
394
  type: Input
320
395
  }], valueChange: [{
321
396
  type: Output
397
+ }], touched: [{
398
+ type: Output
322
399
  }], togglerRef: [{
323
400
  type: ViewChild,
324
401
  args: ['togglerRef']
325
402
  }], listboxRef: [{
326
403
  type: ViewChild,
327
404
  args: ['listboxRef']
405
+ }], fieldsetRef: [{
406
+ type: ViewChild,
407
+ args: ['fieldsetRef']
408
+ }], customOption: [{
409
+ type: ContentChild,
410
+ args: [NggDropdownOptionDirective]
328
411
  }] } });
329
412
 
330
- class NggDropdownModule {
331
- }
332
- NggDropdownModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: NggDropdownModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
333
- NggDropdownModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: NggDropdownModule, declarations: [NggDropdownComponent], imports: [CommonModule], exports: [NggDropdownComponent] });
334
- NggDropdownModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: NggDropdownModule, imports: [[CommonModule]] });
335
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: NggDropdownModule, decorators: [{
336
- type: NgModule,
337
- args: [{
338
- declarations: [NggDropdownComponent],
339
- imports: [CommonModule],
340
- exports: [NggDropdownComponent],
341
- }]
342
- }] });
343
-
344
413
  class NggDatepickerComponent {
345
414
  constructor(_cdr) {
346
415
  this._cdr = _cdr;
347
416
  this.id = randomId();
417
+ this.isValid = null;
348
418
  this.valueChange = new EventEmitter();
349
419
  this._months = months({});
350
- this.years = years({});
351
- this.trackByKey = (index, option) => {
352
- return option.key;
353
- };
354
420
  this.listener = (data, state) => {
355
421
  if (this.dp && state) {
356
422
  this.dp.state = { ...state };
423
+ this.years = years({
424
+ from: this.dp.state?.minDate?.getFullYear(),
425
+ to: this.dp.state?.maxDate?.getFullYear(),
426
+ });
357
427
  }
358
428
  this.onTouchedFn && this.onTouchedFn();
359
429
  if (data) {
360
- this.valueChange.emit(data.selectedDate);
361
- this.onChangeFn && this.onChangeFn(data.selectedDate);
430
+ // only emit change event if date has changed
431
+ if (this.data?.selectedDate !== data.selectedDate) {
432
+ this.valueChange.emit(data.selectedDate);
433
+ this.onChangeFn && this.onChangeFn(data.selectedDate);
434
+ }
362
435
  this.data = data;
363
436
  }
437
+ if (data || state) {
438
+ this._cdr.markForCheck();
439
+ }
364
440
  };
365
441
  }
366
442
  get months() {
@@ -384,15 +460,13 @@ class NggDatepickerComponent {
384
460
  set value(newValue) {
385
461
  if (newValue !== this._value) {
386
462
  this._value = newValue;
463
+ if (this._value && this.dp) {
464
+ this.dp.select(this._value);
465
+ }
387
466
  }
388
467
  }
389
468
  writeValue(value) {
390
469
  this.value = value;
391
- // When binding using ngModel we need to set initial select date
392
- // once we get initial value as it's not available when component is created
393
- if (value && this.dp && !this.data?.selectedDate) {
394
- this.dp.select(value);
395
- }
396
470
  }
397
471
  registerOnChange(fn) {
398
472
  this.onChangeFn = fn;
@@ -406,35 +480,56 @@ class NggDatepickerComponent {
406
480
  set data(value) {
407
481
  this._data = value;
408
482
  }
483
+ onDateChange(value) {
484
+ const newDate = new Date(value);
485
+ // Only pass valid date to date picker
486
+ if (!isNaN(newDate.getTime())) {
487
+ this.dp?.select(value);
488
+ }
489
+ else {
490
+ this.valueChange.emit(value);
491
+ this.onChangeFn && this.onChangeFn(value);
492
+ }
493
+ }
409
494
  trackWeek(index, week) {
410
495
  return week;
411
496
  }
497
+ ngOnChanges(changes) {
498
+ //ignore changes until datepicker has been initialised in ngAfterViewInit
499
+ if (!this.dp)
500
+ return;
501
+ if (changes.options) {
502
+ this._createDatepicker();
503
+ }
504
+ }
412
505
  ngAfterViewInit() {
413
- // initialize datepicker
506
+ this._createDatepicker();
507
+ this._cdr.detectChanges();
508
+ }
509
+ _createDatepicker() {
414
510
  if (this.datepickerElRef &&
415
511
  this.datepickerDialogElRef &&
416
512
  this.dateInputElRef &&
417
- !this.dp) {
513
+ this.datepickerTriggerElRef) {
418
514
  this.dp = createDatepicker(this.listener, {
419
515
  ...this.options,
420
516
  selectedDate: this.value,
421
- }, this.datepickerElRef.nativeElement, this.datepickerDialogElRef.nativeElement, this.dateInputElRef.nativeElement);
422
- this._cdr.detectChanges();
517
+ }, this.datepickerElRef.nativeElement, this.datepickerDialogElRef.nativeElement, this.dateInputElRef.nativeElement, this.datepickerTriggerElRef.nativeElement);
423
518
  }
424
519
  else {
425
520
  throw 'Missing one or more elements...';
426
521
  }
427
522
  }
428
523
  }
429
- NggDatepickerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: NggDatepickerComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
430
- NggDatepickerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.2", type: NggDatepickerComponent, selector: "ngg-datepicker", inputs: { options: "options", value: "value", id: "id", label: "label", valid: "valid", invalid: "invalid" }, outputs: { valueChange: "valueChange" }, providers: [
524
+ NggDatepickerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggDatepickerComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
525
+ NggDatepickerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.3", type: NggDatepickerComponent, selector: "ngg-datepicker", inputs: { options: "options", value: "value", id: "id", label: "label", isValid: "isValid" }, outputs: { valueChange: "valueChange" }, providers: [
431
526
  {
432
527
  provide: NG_VALUE_ACCESSOR,
433
528
  useExisting: NggDatepickerComponent,
434
529
  multi: true,
435
530
  },
436
- ], viewQueries: [{ propertyName: "datepickerDialogElRef", first: true, predicate: ["datepickerDialogElRef"], descendants: true }, { propertyName: "dateInputElRef", first: true, predicate: ["dateInputElRef"], descendants: true }, { propertyName: "datepickerElRef", first: true, predicate: ["datepickerElRef"], descendants: true }], ngImport: i0, template: "<div class=\"form-group\">\n <label *ngIf=\"label\" [for]=\"id\">{{ label }}</label>\n <div\n class=\"group\"\n #datepickerElRef\n [class.is-valid]=\"valid\"\n [class.is-invalid]=\"invalid\"\n >\n <input\n [attr.id]=\"id\"\n [attr.aria-describedby]=\"\n formInfo?.innerText && formInfo.innerText.length > 0\n ? id + '_info'\n : null\n \"\n type=\"text\"\n placeholder=\"yyyy-mm-dd\"\n #dateInputElRef\n [value]=\"data?.formattedSelectedDate || ''\"\n (change)=\"dp?.select(dateInputElRef.value)\"\n />\n <button\n #datepickerTriggerElRef\n (click)=\"dp?.toggle()\"\n type=\"button\"\n class=\"primary\"\n >\n <i class=\"sg-icon sg-icon-calendar\">Select date</i>\n </button>\n </div>\n <span class=\"form-info\" #formInfo [attr.id]=\"id + '_info'\"\n ><ng-content select=\"[data-form-info]\"></ng-content\n ></span>\n</div>\n<!-- TODO: get or set attributes from within datepicker instance (dp) -->\n<div\n #datepickerDialogElRef\n class=\"sg-date\"\n [class.active]=\"dp?.state?.isActive\"\n role=\"dialog\"\n aria-modal=\"true\"\n aria-label=\"Choose Date\"\n>\n <header>\n <button type=\"button\" class=\"link\" (click)=\"dp?.sub(1, 'months')\">\n <i class=\"sg-icon sg-icon-previous\">Previous month</i>\n </button>\n <ngg-dropdown\n [options]=\"months\"\n text=\"Select\"\n [value]=\"data?.month\"\n (valueChange)=\"dp?.setMonth($event)\"\n ></ngg-dropdown>\n <ngg-dropdown\n [options]=\"years\"\n text=\"Select\"\n [value]=\"data?.year\"\n (valueChange)=\"dp?.setYear($event)\"\n ></ngg-dropdown>\n <button type=\"button\" class=\"link\" (click)=\"dp?.add(1, 'months')\">\n <i class=\"sg-icon sg-icon-next\">Next month</i>\n </button>\n </header>\n <main>\n <table role=\"grid\">\n <thead>\n <tr>\n <th\n scope=\"col\"\n *ngFor=\"let header of data?.calendar?.headers\"\n [abbr]=\"header.abbr\"\n [class.sg-week-header]=\"header.type === 'week'\"\n [class.sg-day-header]=\"header.type === 'day'\"\n >\n {{ header.displayText }}\n </th>\n </tr>\n </thead>\n <tbody>\n <tr\n *ngFor=\"\n let week of data?.calendar?.calendarGrid;\n trackBy: trackWeek;\n let i = index\n \"\n >\n <th\n *ngIf=\"data?.calendar?.weekNumbers as weekNumbers\"\n class=\"sg-week-number\"\n >\n {{ weekNumbers[i] }}\n </th>\n <td\n *ngFor=\"let day of week\"\n [attr.data-date]=\"day.formattedDate\"\n [attr.role]=\"day.selected ? 'gridcell' : null\"\n [attr.aria-selected]=\"day.selected ? true : null\"\n [class.disabled]=\"!day.currentMonth\"\n [class.sg-date-today]=\"day.today\"\n [title]=\"day.today ? 'Today' : ''\"\n tabindex=\"-1\"\n (click)=\"day.currentMonth && dp?.select(day.date)\"\n >\n {{ day.day }}\n </td>\n </tr>\n </tbody>\n </table>\n </main>\n</div>\n", components: [{ type: NggDropdownComponent, selector: "ngg-dropdown", inputs: ["id", "text", "loop", "label", "options", "valid", "invalid", "value"], outputs: ["valueChange"] }], directives: [{ type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
437
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: NggDatepickerComponent, decorators: [{
531
+ ], viewQueries: [{ propertyName: "datepickerDialogElRef", first: true, predicate: ["datepickerDialogElRef"], descendants: true }, { propertyName: "dateInputElRef", first: true, predicate: ["dateInputElRef"], descendants: true }, { propertyName: "datepickerElRef", first: true, predicate: ["datepickerElRef"], descendants: true }, { propertyName: "datepickerTriggerElRef", first: true, predicate: ["datepickerTriggerElRef"], descendants: true }], usesOnChanges: true, ngImport: i0, template: "<div class=\"form-group\">\n <label *ngIf=\"label\" [for]=\"id\">{{ label }}</label>\n <div\n class=\"group\"\n #datepickerElRef\n [class.is-valid]=\"isValid\"\n [class.is-invalid]=\"isValid === false\"\n >\n <input\n [attr.id]=\"id\"\n [attr.aria-describedby]=\"\n formInfo?.innerText && formInfo.innerText.length > 0\n ? id + '_info'\n : null\n \"\n type=\"text\"\n placeholder=\"yyyy-mm-dd\"\n #dateInputElRef\n [value]=\"data?.formattedSelectedDate || ''\"\n (change)=\"onDateChange(dateInputElRef.value)\"\n />\n <button\n #datepickerTriggerElRef\n (click)=\"dp?.toggle()\"\n type=\"button\"\n class=\"primary\"\n >\n <i class=\"sg-icon sg-icon-calendar\">Select date</i>\n </button>\n </div>\n <span class=\"form-info\" #formInfo [attr.id]=\"id + '_info'\"\n ><ng-content select=\"[data-form-info]\"></ng-content\n ></span>\n</div>\n<!-- TODO: get or set attributes from within datepicker instance (dp) -->\n<div\n #datepickerDialogElRef\n class=\"popover popover-datepicker\"\n [class.active]=\"dp?.state?.isActive\"\n role=\"dialog\"\n aria-modal=\"true\"\n aria-label=\"Choose Date\"\n>\n <button type=\"button\" class=\"close\" (click)=\"dp?.close()\"><i></i>Close</button>\n <div class=\"sg-date\">\n <header>\n <button type=\"button\" class=\"link\" (click)=\"dp?.sub(1, 'months')\">\n <i class=\"sg-icon sg-icon-previous\">Previous month</i>\n </button>\n <ngg-dropdown\n [options]=\"months\"\n display=\"key\"\n text=\"Select\"\n [value]=\"data?.month\"\n (valueChange)=\"dp?.setMonth($event)\"\n ></ngg-dropdown>\n <ngg-dropdown\n *ngIf=\"years\"\n [options]=\"years\"\n display=\"key\"\n text=\"Select\"\n [value]=\"data?.year\"\n (valueChange)=\"dp?.setYear($event)\"\n ></ngg-dropdown>\n <button type=\"button\" class=\"link\" (click)=\"dp?.add(1, 'months')\">\n <i class=\"sg-icon sg-icon-next\">Next month</i>\n </button>\n </header>\n <main>\n <table role=\"grid\">\n <thead>\n <tr>\n <th\n scope=\"col\"\n *ngFor=\"let header of data?.calendar?.headers\"\n [abbr]=\"header.abbr\"\n [class.sg-week-header]=\"header.type === 'week'\"\n [class.sg-day-header]=\"header.type === 'day'\"\n >\n {{ header.displayText }}\n </th>\n </tr>\n </thead>\n <tbody>\n <tr\n *ngFor=\"\n let week of data?.calendar?.calendarGrid;\n trackBy: trackWeek;\n let i = index\n \"\n >\n <th\n *ngIf=\"data?.calendar?.weekNumbers as weekNumbers\"\n class=\"sg-week-number\"\n >\n {{ weekNumbers[i] }}\n </th>\n <td\n *ngFor=\"let day of week\"\n [attr.data-date]=\"day.formattedDate\"\n [attr.role]=\"day.selected ? 'gridcell' : null\"\n [attr.aria-selected]=\"\n day.selected && !data?.highlightedDate ? true : null\n \"\n [class.disabled]=\"day.disabled\"\n [class.sg-date-today]=\"day.today\"\n [title]=\"day.today ? 'Today' : ''\"\n [tabIndex]=\"\n day.highlighted ||\n (day.selected && !data?.highlightedDate) ||\n (day.today && !data?.highlightedDate && !data?.selectedDate)\n ? 0\n : -1\n \"\n (click)=\"day.currentMonth && dp?.select(day.date)\"\n >\n {{ day.day }}\n </td>\n </tr>\n </tbody>\n </table>\n </main>\n </div>\n</div>\n", components: [{ type: NggDropdownComponent, selector: "ngg-dropdown", inputs: ["id", "texts", "loop", "display", "useValue", "label", "options", "valid", "invalid", "compareWith", "searchFilter", "multiSelect", "searchable", "value"], outputs: ["valueChange", "touched"] }], directives: [{ type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
532
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggDatepickerComponent, decorators: [{
438
533
  type: Component,
439
534
  args: [{ selector: 'ngg-datepicker', providers: [
440
535
  {
@@ -442,7 +537,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.2", ngImpor
442
537
  useExisting: NggDatepickerComponent,
443
538
  multi: true,
444
539
  },
445
- ], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"form-group\">\n <label *ngIf=\"label\" [for]=\"id\">{{ label }}</label>\n <div\n class=\"group\"\n #datepickerElRef\n [class.is-valid]=\"valid\"\n [class.is-invalid]=\"invalid\"\n >\n <input\n [attr.id]=\"id\"\n [attr.aria-describedby]=\"\n formInfo?.innerText && formInfo.innerText.length > 0\n ? id + '_info'\n : null\n \"\n type=\"text\"\n placeholder=\"yyyy-mm-dd\"\n #dateInputElRef\n [value]=\"data?.formattedSelectedDate || ''\"\n (change)=\"dp?.select(dateInputElRef.value)\"\n />\n <button\n #datepickerTriggerElRef\n (click)=\"dp?.toggle()\"\n type=\"button\"\n class=\"primary\"\n >\n <i class=\"sg-icon sg-icon-calendar\">Select date</i>\n </button>\n </div>\n <span class=\"form-info\" #formInfo [attr.id]=\"id + '_info'\"\n ><ng-content select=\"[data-form-info]\"></ng-content\n ></span>\n</div>\n<!-- TODO: get or set attributes from within datepicker instance (dp) -->\n<div\n #datepickerDialogElRef\n class=\"sg-date\"\n [class.active]=\"dp?.state?.isActive\"\n role=\"dialog\"\n aria-modal=\"true\"\n aria-label=\"Choose Date\"\n>\n <header>\n <button type=\"button\" class=\"link\" (click)=\"dp?.sub(1, 'months')\">\n <i class=\"sg-icon sg-icon-previous\">Previous month</i>\n </button>\n <ngg-dropdown\n [options]=\"months\"\n text=\"Select\"\n [value]=\"data?.month\"\n (valueChange)=\"dp?.setMonth($event)\"\n ></ngg-dropdown>\n <ngg-dropdown\n [options]=\"years\"\n text=\"Select\"\n [value]=\"data?.year\"\n (valueChange)=\"dp?.setYear($event)\"\n ></ngg-dropdown>\n <button type=\"button\" class=\"link\" (click)=\"dp?.add(1, 'months')\">\n <i class=\"sg-icon sg-icon-next\">Next month</i>\n </button>\n </header>\n <main>\n <table role=\"grid\">\n <thead>\n <tr>\n <th\n scope=\"col\"\n *ngFor=\"let header of data?.calendar?.headers\"\n [abbr]=\"header.abbr\"\n [class.sg-week-header]=\"header.type === 'week'\"\n [class.sg-day-header]=\"header.type === 'day'\"\n >\n {{ header.displayText }}\n </th>\n </tr>\n </thead>\n <tbody>\n <tr\n *ngFor=\"\n let week of data?.calendar?.calendarGrid;\n trackBy: trackWeek;\n let i = index\n \"\n >\n <th\n *ngIf=\"data?.calendar?.weekNumbers as weekNumbers\"\n class=\"sg-week-number\"\n >\n {{ weekNumbers[i] }}\n </th>\n <td\n *ngFor=\"let day of week\"\n [attr.data-date]=\"day.formattedDate\"\n [attr.role]=\"day.selected ? 'gridcell' : null\"\n [attr.aria-selected]=\"day.selected ? true : null\"\n [class.disabled]=\"!day.currentMonth\"\n [class.sg-date-today]=\"day.today\"\n [title]=\"day.today ? 'Today' : ''\"\n tabindex=\"-1\"\n (click)=\"day.currentMonth && dp?.select(day.date)\"\n >\n {{ day.day }}\n </td>\n </tr>\n </tbody>\n </table>\n </main>\n</div>\n" }]
540
+ ], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"form-group\">\n <label *ngIf=\"label\" [for]=\"id\">{{ label }}</label>\n <div\n class=\"group\"\n #datepickerElRef\n [class.is-valid]=\"isValid\"\n [class.is-invalid]=\"isValid === false\"\n >\n <input\n [attr.id]=\"id\"\n [attr.aria-describedby]=\"\n formInfo?.innerText && formInfo.innerText.length > 0\n ? id + '_info'\n : null\n \"\n type=\"text\"\n placeholder=\"yyyy-mm-dd\"\n #dateInputElRef\n [value]=\"data?.formattedSelectedDate || ''\"\n (change)=\"onDateChange(dateInputElRef.value)\"\n />\n <button\n #datepickerTriggerElRef\n (click)=\"dp?.toggle()\"\n type=\"button\"\n class=\"primary\"\n >\n <i class=\"sg-icon sg-icon-calendar\">Select date</i>\n </button>\n </div>\n <span class=\"form-info\" #formInfo [attr.id]=\"id + '_info'\"\n ><ng-content select=\"[data-form-info]\"></ng-content\n ></span>\n</div>\n<!-- TODO: get or set attributes from within datepicker instance (dp) -->\n<div\n #datepickerDialogElRef\n class=\"popover popover-datepicker\"\n [class.active]=\"dp?.state?.isActive\"\n role=\"dialog\"\n aria-modal=\"true\"\n aria-label=\"Choose Date\"\n>\n <button type=\"button\" class=\"close\" (click)=\"dp?.close()\"><i></i>Close</button>\n <div class=\"sg-date\">\n <header>\n <button type=\"button\" class=\"link\" (click)=\"dp?.sub(1, 'months')\">\n <i class=\"sg-icon sg-icon-previous\">Previous month</i>\n </button>\n <ngg-dropdown\n [options]=\"months\"\n display=\"key\"\n text=\"Select\"\n [value]=\"data?.month\"\n (valueChange)=\"dp?.setMonth($event)\"\n ></ngg-dropdown>\n <ngg-dropdown\n *ngIf=\"years\"\n [options]=\"years\"\n display=\"key\"\n text=\"Select\"\n [value]=\"data?.year\"\n (valueChange)=\"dp?.setYear($event)\"\n ></ngg-dropdown>\n <button type=\"button\" class=\"link\" (click)=\"dp?.add(1, 'months')\">\n <i class=\"sg-icon sg-icon-next\">Next month</i>\n </button>\n </header>\n <main>\n <table role=\"grid\">\n <thead>\n <tr>\n <th\n scope=\"col\"\n *ngFor=\"let header of data?.calendar?.headers\"\n [abbr]=\"header.abbr\"\n [class.sg-week-header]=\"header.type === 'week'\"\n [class.sg-day-header]=\"header.type === 'day'\"\n >\n {{ header.displayText }}\n </th>\n </tr>\n </thead>\n <tbody>\n <tr\n *ngFor=\"\n let week of data?.calendar?.calendarGrid;\n trackBy: trackWeek;\n let i = index\n \"\n >\n <th\n *ngIf=\"data?.calendar?.weekNumbers as weekNumbers\"\n class=\"sg-week-number\"\n >\n {{ weekNumbers[i] }}\n </th>\n <td\n *ngFor=\"let day of week\"\n [attr.data-date]=\"day.formattedDate\"\n [attr.role]=\"day.selected ? 'gridcell' : null\"\n [attr.aria-selected]=\"\n day.selected && !data?.highlightedDate ? true : null\n \"\n [class.disabled]=\"day.disabled\"\n [class.sg-date-today]=\"day.today\"\n [title]=\"day.today ? 'Today' : ''\"\n [tabIndex]=\"\n day.highlighted ||\n (day.selected && !data?.highlightedDate) ||\n (day.today && !data?.highlightedDate && !data?.selectedDate)\n ? 0\n : -1\n \"\n (click)=\"day.currentMonth && dp?.select(day.date)\"\n >\n {{ day.day }}\n </td>\n </tr>\n </tbody>\n </table>\n </main>\n </div>\n</div>\n" }]
446
541
  }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { options: [{
447
542
  type: Input
448
543
  }], value: [{
@@ -451,9 +546,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.2", ngImpor
451
546
  type: Input
452
547
  }], label: [{
453
548
  type: Input
454
- }], valid: [{
455
- type: Input
456
- }], invalid: [{
549
+ }], isValid: [{
457
550
  type: Input
458
551
  }], valueChange: [{
459
552
  type: Output
@@ -466,14 +559,63 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.2", ngImpor
466
559
  }], datepickerElRef: [{
467
560
  type: ViewChild,
468
561
  args: ['datepickerElRef']
562
+ }], datepickerTriggerElRef: [{
563
+ type: ViewChild,
564
+ args: ['datepickerTriggerElRef']
469
565
  }] } });
566
+ function dateValidator(dates) {
567
+ return (control) => {
568
+ const value = control.value;
569
+ if (!value) {
570
+ return null;
571
+ }
572
+ const newDate = new Date(value);
573
+ const isValidDate = !isNaN(newDate.getTime());
574
+ if (!isValidDate) {
575
+ return { validDate: true };
576
+ }
577
+ const validMinDate = dates?.min ? newDate >= startOfDay(dates.min) : true;
578
+ const validMaxDate = dates?.max ? newDate <= endOfDay(dates.max) : true;
579
+ if (!validMinDate && dates?.min) {
580
+ return {
581
+ validDate: {
582
+ minDate: startOfDay(dates.min),
583
+ actualDate: newDate,
584
+ },
585
+ };
586
+ }
587
+ if (!validMaxDate && dates?.max) {
588
+ return {
589
+ validDate: {
590
+ maxDate: endOfDay(dates.max),
591
+ actualDate: newDate,
592
+ },
593
+ };
594
+ }
595
+ return null;
596
+ };
597
+ }
598
+
599
+ class NggDropdownModule {
600
+ }
601
+ NggDropdownModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggDropdownModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
602
+ NggDropdownModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggDropdownModule, declarations: [NggDropdownComponent, NggDropdownOptionDirective], imports: [CommonModule], exports: [NggDropdownComponent, NggDropdownOptionDirective] });
603
+ NggDropdownModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggDropdownModule, imports: [[CommonModule]] });
604
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggDropdownModule, decorators: [{
605
+ type: NgModule,
606
+ args: [{
607
+ declarations: [NggDropdownComponent, NggDropdownOptionDirective],
608
+ imports: [CommonModule],
609
+ exports: [NggDropdownComponent, NggDropdownOptionDirective],
610
+ }]
611
+ }] });
470
612
 
471
613
  class NggDatepickerModule {
472
614
  }
473
- NggDatepickerModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: NggDatepickerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
474
- NggDatepickerModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: NggDatepickerModule, declarations: [NggDatepickerComponent], imports: [CommonModule, NggDropdownModule], exports: [NggDatepickerComponent] });
475
- NggDatepickerModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: NggDatepickerModule, imports: [[CommonModule, NggDropdownModule]] });
476
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: NggDatepickerModule, decorators: [{
615
+ NggDatepickerModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggDatepickerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
616
+ NggDatepickerModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggDatepickerModule, declarations: [NggDatepickerComponent], imports: [CommonModule, NggDropdownModule], exports: [NggDatepickerComponent] });
617
+ NggDatepickerModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggDatepickerModule, imports: [[CommonModule, NggDropdownModule]] });
618
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggDatepickerModule, decorators: [{
477
619
  type: NgModule,
478
620
  args: [{
479
621
  declarations: [NggDatepickerComponent],
@@ -482,17 +624,402 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.2", ngImpor
482
624
  }]
483
625
  }] });
484
626
 
627
+ class NggModalComponent {
628
+ constructor(ref, configurableFocusTrapFactory) {
629
+ this.ref = ref;
630
+ this.configurableFocusTrapFactory = configurableFocusTrapFactory;
631
+ this.isOpenChange = new EventEmitter();
632
+ this.closed = new EventEmitter();
633
+ this.confirm = new EventEmitter();
634
+ this.dismiss = new EventEmitter();
635
+ this.configurableFocusTrap = this.configurableFocusTrapFactory.create(this.ref.nativeElement);
636
+ }
637
+ get trapFocus() {
638
+ return this._trapFocus;
639
+ }
640
+ set trapFocus(value) {
641
+ this._trapFocus = value;
642
+ if (value) {
643
+ if (this._isOpen) {
644
+ this.enableFocusTrap();
645
+ }
646
+ }
647
+ else {
648
+ this.disableFocusTrap();
649
+ }
650
+ }
651
+ get isOpen() {
652
+ return this._isOpen;
653
+ }
654
+ set isOpen(value) {
655
+ this._isOpen = value;
656
+ if (value) {
657
+ if (this.trapFocus) {
658
+ this.enableFocusTrap();
659
+ }
660
+ disableBodyScroll(this.ref.nativeElement);
661
+ }
662
+ else {
663
+ this.disableFocusTrap();
664
+ enableBodyScroll(this.ref.nativeElement);
665
+ }
666
+ }
667
+ get open() { return this.isOpen; }
668
+ ngOnInit() {
669
+ if (this._isOpen && this.trapFocus)
670
+ this.enableFocusTrap();
671
+ else
672
+ this.disableFocusTrap();
673
+ }
674
+ handleCloseClick(event) {
675
+ this.closeModal(event);
676
+ }
677
+ handleBackdropClick(event) {
678
+ if (event.target == this.backdropRef?.nativeElement)
679
+ this.closeModal(event);
680
+ }
681
+ handleDismiss(event) {
682
+ this.dismiss.emit(event);
683
+ }
684
+ handleConfirm(event) {
685
+ this.confirm.emit(event);
686
+ }
687
+ closeModal(event) {
688
+ if (this.closed.observers.length > 0) {
689
+ this.closed.emit(event);
690
+ }
691
+ else {
692
+ this.isOpen = false;
693
+ this.isOpenChange.emit(this.isOpen);
694
+ }
695
+ }
696
+ enableFocusTrap() {
697
+ if (this.configurableFocusTrap) {
698
+ this.configurableFocusTrap.enabled = true;
699
+ this.configurableFocusTrap.focusInitialElementWhenReady();
700
+ }
701
+ }
702
+ disableFocusTrap() {
703
+ if (this.configurableFocusTrap) {
704
+ this.configurableFocusTrap.enabled = false;
705
+ }
706
+ }
707
+ ngOnDestroy() {
708
+ this.configurableFocusTrap?.destroy();
709
+ enableBodyScroll(this.ref.nativeElement);
710
+ }
711
+ }
712
+ NggModalComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggModalComponent, deps: [{ token: i0.ElementRef }, { token: i1.ConfigurableFocusTrapFactory }], target: i0.ɵɵFactoryTarget.Component });
713
+ NggModalComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.3", type: NggModalComponent, selector: "ngg-modal", inputs: { modalType: "modalType", header: "header", confirmLabel: "confirmLabel", dismissLabel: "dismissLabel", size: "size", trapFocus: "trapFocus", isOpen: "isOpen" }, outputs: { isOpenChange: "isOpenChange", closed: "closed", confirm: "confirm", dismiss: "dismiss" }, host: { properties: { "class.open": "this.open" } }, viewQueries: [{ propertyName: "backdropRef", first: true, predicate: ["backdrop"], descendants: true }], ngImport: i0, template: "<ng-container *ngIf=\"isOpen\" [ngSwitch]=\"modalType\">\n <aside data-testid=\"modal\" *ngSwitchCase=\"'slideout'\" role=\"dialog\" aria-modal=\"true\" [class.small]=\"size === 'sm'\" [class.medium]=\"size === 'md'\" [class.large]=\"size === 'lg'\">\n <header ngg-modal-header data-testid=\"modal-header\" [header]=\"header\" (closed)=\"this.handleCloseClick($event)\"></header>\n <div ngg-modal-body data-testid=\"modal-body\" class=\"body\">\n <ng-container *ngTemplateOutlet=\"contentTpl\"></ng-container> \n </div>\n <footer ngg-modal-footer data-testid=\"modal-footer\" *ngIf=\"dismissLabel || confirmLabel\" [dismissLabel]=\"dismissLabel\" [confirmLabel]=\"confirmLabel\" (dismiss)=\"this.handleDismiss($event)\" (confirm)=\"this.handleConfirm($event)\"></footer>\n </aside>\n <main data-testid=\"modal\" *ngSwitchCase=\"'takeover'\" role=\"dialog\" aria-modal=\"true\">\n <header ngg-modal-header data-testid=\"modal-header\" [header]=\"header\" (closed)=\"this.handleCloseClick($event)\"></header>\n <div ngg-modal-body data-testid=\"modal-body\" class=\"body\">\n <ng-container *ngTemplateOutlet=\"contentTpl\"></ng-container> \n </div>\n <footer ngg-modal-footer data-testid=\"modal-footer\" *ngIf=\"dismissLabel || confirmLabel\" [dismissLabel]=\"dismissLabel\" [confirmLabel]=\"confirmLabel\" (dismiss)=\"this.handleDismiss($event)\" (confirm)=\"this.handleConfirm($event)\"></footer>\n </main>\n <section data-testid=\"modal\" *ngSwitchDefault role=\"dialog\" aria-modal=\"true\" [class.small]=\"size === 'sm'\" [class.medium]=\"size === 'md'\" [class.large]=\"size === 'lg'\">\n <header ngg-modal-header data-testid=\"modal-header\" [header]=\"header\" (closed)=\"this.handleCloseClick($event)\"></header>\n <div ngg-modal-body data-testid=\"modal-body\" class=\"body\">\n <ng-container *ngTemplateOutlet=\"contentTpl\"></ng-container> \n </div>\n <footer ngg-modal-footer data-testid=\"modal-footer\" *ngIf=\"dismissLabel || confirmLabel\" [dismissLabel]=\"dismissLabel\" [confirmLabel]=\"confirmLabel\" (dismiss)=\"this.handleDismiss($event)\" (confirm)=\"this.handleConfirm($event)\"></footer>\n </section>\n <ng-template #contentTpl>\n <ng-content></ng-content>\n </ng-template>\n <div #backdrop data-testid=\"modal-backdrop\" class=\"backdrop\" (click)=\"this.handleBackdropClick($event)\" [attr.aria-hidden]=\"true\"></div>\n</ng-container>", styles: [":host.open{height:100vh;left:0;overflow:hidden;position:fixed;top:0;width:100%;z-index:var(--sg-z-index-modal-backdrop)}:host.open>section[role=dialog]{left:50%;top:50%;transform:translate(-50%,-50%)}.body::-webkit-scrollbar{background-color:#f8f8f8;height:10px;width:10px}.body::-webkit-scrollbar-thumb{background-color:#cecece}.body::-webkit-scrollbar-track{background-color:#f8f8f8;box-shadow:inset 0 0 10px #00000040}\n"], components: [{ type: i0.forwardRef(function () { return NggModalHeaderComponent; }), selector: "[ngg-modal-header]", inputs: ["header"], outputs: ["closed"] }, { type: i0.forwardRef(function () { return NggModalBodyComponent; }), selector: "[ngg-modal-body]" }, { type: i0.forwardRef(function () { return NggModalFooterComponent; }), selector: "[ngg-modal-footer]", inputs: ["dismissLabel", "confirmLabel"], outputs: ["dismiss", "confirm"] }], directives: [{ type: i0.forwardRef(function () { return i2.NgIf; }), selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i0.forwardRef(function () { return i2.NgSwitch; }), selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i0.forwardRef(function () { return i2.NgSwitchCase; }), selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: i0.forwardRef(function () { return i2.NgTemplateOutlet; }), selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i0.forwardRef(function () { return i2.NgSwitchDefault; }), selector: "[ngSwitchDefault]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
714
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggModalComponent, decorators: [{
715
+ type: Component,
716
+ args: [{ selector: 'ngg-modal', changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-container *ngIf=\"isOpen\" [ngSwitch]=\"modalType\">\n <aside data-testid=\"modal\" *ngSwitchCase=\"'slideout'\" role=\"dialog\" aria-modal=\"true\" [class.small]=\"size === 'sm'\" [class.medium]=\"size === 'md'\" [class.large]=\"size === 'lg'\">\n <header ngg-modal-header data-testid=\"modal-header\" [header]=\"header\" (closed)=\"this.handleCloseClick($event)\"></header>\n <div ngg-modal-body data-testid=\"modal-body\" class=\"body\">\n <ng-container *ngTemplateOutlet=\"contentTpl\"></ng-container> \n </div>\n <footer ngg-modal-footer data-testid=\"modal-footer\" *ngIf=\"dismissLabel || confirmLabel\" [dismissLabel]=\"dismissLabel\" [confirmLabel]=\"confirmLabel\" (dismiss)=\"this.handleDismiss($event)\" (confirm)=\"this.handleConfirm($event)\"></footer>\n </aside>\n <main data-testid=\"modal\" *ngSwitchCase=\"'takeover'\" role=\"dialog\" aria-modal=\"true\">\n <header ngg-modal-header data-testid=\"modal-header\" [header]=\"header\" (closed)=\"this.handleCloseClick($event)\"></header>\n <div ngg-modal-body data-testid=\"modal-body\" class=\"body\">\n <ng-container *ngTemplateOutlet=\"contentTpl\"></ng-container> \n </div>\n <footer ngg-modal-footer data-testid=\"modal-footer\" *ngIf=\"dismissLabel || confirmLabel\" [dismissLabel]=\"dismissLabel\" [confirmLabel]=\"confirmLabel\" (dismiss)=\"this.handleDismiss($event)\" (confirm)=\"this.handleConfirm($event)\"></footer>\n </main>\n <section data-testid=\"modal\" *ngSwitchDefault role=\"dialog\" aria-modal=\"true\" [class.small]=\"size === 'sm'\" [class.medium]=\"size === 'md'\" [class.large]=\"size === 'lg'\">\n <header ngg-modal-header data-testid=\"modal-header\" [header]=\"header\" (closed)=\"this.handleCloseClick($event)\"></header>\n <div ngg-modal-body data-testid=\"modal-body\" class=\"body\">\n <ng-container *ngTemplateOutlet=\"contentTpl\"></ng-container> \n </div>\n <footer ngg-modal-footer data-testid=\"modal-footer\" *ngIf=\"dismissLabel || confirmLabel\" [dismissLabel]=\"dismissLabel\" [confirmLabel]=\"confirmLabel\" (dismiss)=\"this.handleDismiss($event)\" (confirm)=\"this.handleConfirm($event)\"></footer>\n </section>\n <ng-template #contentTpl>\n <ng-content></ng-content>\n </ng-template>\n <div #backdrop data-testid=\"modal-backdrop\" class=\"backdrop\" (click)=\"this.handleBackdropClick($event)\" [attr.aria-hidden]=\"true\"></div>\n</ng-container>", styles: [":host.open{height:100vh;left:0;overflow:hidden;position:fixed;top:0;width:100%;z-index:var(--sg-z-index-modal-backdrop)}:host.open>section[role=dialog]{left:50%;top:50%;transform:translate(-50%,-50%)}.body::-webkit-scrollbar{background-color:#f8f8f8;height:10px;width:10px}.body::-webkit-scrollbar-thumb{background-color:#cecece}.body::-webkit-scrollbar-track{background-color:#f8f8f8;box-shadow:inset 0 0 10px #00000040}\n"] }]
717
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i1.ConfigurableFocusTrapFactory }]; }, propDecorators: { modalType: [{
718
+ type: Input
719
+ }], header: [{
720
+ type: Input
721
+ }], confirmLabel: [{
722
+ type: Input
723
+ }], dismissLabel: [{
724
+ type: Input
725
+ }], size: [{
726
+ type: Input
727
+ }], trapFocus: [{
728
+ type: Input
729
+ }], isOpen: [{
730
+ type: Input
731
+ }], isOpenChange: [{
732
+ type: Output
733
+ }], closed: [{
734
+ type: Output
735
+ }], confirm: [{
736
+ type: Output
737
+ }], dismiss: [{
738
+ type: Output
739
+ }], open: [{
740
+ type: HostBinding,
741
+ args: ['class.open']
742
+ }], backdropRef: [{
743
+ type: ViewChild,
744
+ args: ['backdrop']
745
+ }] } });
746
+ class NggModalHeaderComponent {
747
+ constructor() {
748
+ this.closed = new EventEmitter();
749
+ }
750
+ handleClose(event) {
751
+ this.closed.emit(event);
752
+ }
753
+ }
754
+ NggModalHeaderComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggModalHeaderComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
755
+ NggModalHeaderComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.3", type: NggModalHeaderComponent, selector: "[ngg-modal-header]", inputs: { header: "header" }, outputs: { closed: "closed" }, ngImport: i0, template: `
756
+ <h3 data-testid="modal-header-text">{{header}}</h3>
757
+ <button data-testid="modal-close-button" class="close" (click)="this.handleClose($event)">
758
+ <span className="sr-only">Close</span>
759
+ <i></i>
760
+ </button>
761
+ `, isInline: true, styles: [":host.open{height:100vh;left:0;overflow:hidden;position:fixed;top:0;width:100%;z-index:var(--sg-z-index-modal-backdrop)}:host.open>section[role=dialog]{left:50%;top:50%;transform:translate(-50%,-50%)}.body::-webkit-scrollbar{background-color:#f8f8f8;height:10px;width:10px}.body::-webkit-scrollbar-thumb{background-color:#cecece}.body::-webkit-scrollbar-track{background-color:#f8f8f8;box-shadow:inset 0 0 10px #00000040}\n"] });
762
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggModalHeaderComponent, decorators: [{
763
+ type: Component,
764
+ args: [{ selector: '[ngg-modal-header]', template: `
765
+ <h3 data-testid="modal-header-text">{{header}}</h3>
766
+ <button data-testid="modal-close-button" class="close" (click)="this.handleClose($event)">
767
+ <span className="sr-only">Close</span>
768
+ <i></i>
769
+ </button>
770
+ `, styles: [":host.open{height:100vh;left:0;overflow:hidden;position:fixed;top:0;width:100%;z-index:var(--sg-z-index-modal-backdrop)}:host.open>section[role=dialog]{left:50%;top:50%;transform:translate(-50%,-50%)}.body::-webkit-scrollbar{background-color:#f8f8f8;height:10px;width:10px}.body::-webkit-scrollbar-thumb{background-color:#cecece}.body::-webkit-scrollbar-track{background-color:#f8f8f8;box-shadow:inset 0 0 10px #00000040}\n"] }]
771
+ }], propDecorators: { header: [{
772
+ type: Input
773
+ }], closed: [{
774
+ type: Output
775
+ }] } });
776
+ class NggModalBodyComponent {
777
+ }
778
+ NggModalBodyComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggModalBodyComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
779
+ NggModalBodyComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.3", type: NggModalBodyComponent, selector: "[ngg-modal-body]", ngImport: i0, template: `<ng-content></ng-content>`, isInline: true, styles: [":host.open{height:100vh;left:0;overflow:hidden;position:fixed;top:0;width:100%;z-index:var(--sg-z-index-modal-backdrop)}:host.open>section[role=dialog]{left:50%;top:50%;transform:translate(-50%,-50%)}.body::-webkit-scrollbar{background-color:#f8f8f8;height:10px;width:10px}.body::-webkit-scrollbar-thumb{background-color:#cecece}.body::-webkit-scrollbar-track{background-color:#f8f8f8;box-shadow:inset 0 0 10px #00000040}\n"] });
780
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggModalBodyComponent, decorators: [{
781
+ type: Component,
782
+ args: [{ selector: '[ngg-modal-body]', template: `<ng-content></ng-content>`, styles: [":host.open{height:100vh;left:0;overflow:hidden;position:fixed;top:0;width:100%;z-index:var(--sg-z-index-modal-backdrop)}:host.open>section[role=dialog]{left:50%;top:50%;transform:translate(-50%,-50%)}.body::-webkit-scrollbar{background-color:#f8f8f8;height:10px;width:10px}.body::-webkit-scrollbar-thumb{background-color:#cecece}.body::-webkit-scrollbar-track{background-color:#f8f8f8;box-shadow:inset 0 0 10px #00000040}\n"] }]
783
+ }] });
784
+ class NggModalFooterComponent {
785
+ constructor() {
786
+ this.dismiss = new EventEmitter();
787
+ this.confirm = new EventEmitter();
788
+ }
789
+ handleDismiss(event) {
790
+ this.dismiss.emit(event);
791
+ }
792
+ handleConfirm(event) {
793
+ this.confirm.emit(event);
794
+ }
795
+ }
796
+ NggModalFooterComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggModalFooterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
797
+ NggModalFooterComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.3", type: NggModalFooterComponent, selector: "[ngg-modal-footer]", inputs: { dismissLabel: "dismissLabel", confirmLabel: "confirmLabel" }, outputs: { dismiss: "dismiss", confirm: "confirm" }, ngImport: i0, template: `
798
+ <button data-testid="modal-dismiss-button" *ngIf="dismissLabel" class="secondary" (click)="this.handleDismiss($event)">{{dismissLabel}}</button>
799
+ <button data-testid="modal-confirm-button" *ngIf="confirmLabel" class="primary" (click)="this.handleConfirm($event)">{{confirmLabel}}</button>
800
+ `, isInline: true, styles: [":host.open{height:100vh;left:0;overflow:hidden;position:fixed;top:0;width:100%;z-index:var(--sg-z-index-modal-backdrop)}:host.open>section[role=dialog]{left:50%;top:50%;transform:translate(-50%,-50%)}.body::-webkit-scrollbar{background-color:#f8f8f8;height:10px;width:10px}.body::-webkit-scrollbar-thumb{background-color:#cecece}.body::-webkit-scrollbar-track{background-color:#f8f8f8;box-shadow:inset 0 0 10px #00000040}\n"], directives: [{ type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
801
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggModalFooterComponent, decorators: [{
802
+ type: Component,
803
+ args: [{ selector: '[ngg-modal-footer]', template: `
804
+ <button data-testid="modal-dismiss-button" *ngIf="dismissLabel" class="secondary" (click)="this.handleDismiss($event)">{{dismissLabel}}</button>
805
+ <button data-testid="modal-confirm-button" *ngIf="confirmLabel" class="primary" (click)="this.handleConfirm($event)">{{confirmLabel}}</button>
806
+ `, styles: [":host.open{height:100vh;left:0;overflow:hidden;position:fixed;top:0;width:100%;z-index:var(--sg-z-index-modal-backdrop)}:host.open>section[role=dialog]{left:50%;top:50%;transform:translate(-50%,-50%)}.body::-webkit-scrollbar{background-color:#f8f8f8;height:10px;width:10px}.body::-webkit-scrollbar-thumb{background-color:#cecece}.body::-webkit-scrollbar-track{background-color:#f8f8f8;box-shadow:inset 0 0 10px #00000040}\n"] }]
807
+ }], propDecorators: { dismissLabel: [{
808
+ type: Input
809
+ }], confirmLabel: [{
810
+ type: Input
811
+ }], dismiss: [{
812
+ type: Output
813
+ }], confirm: [{
814
+ type: Output
815
+ }] } });
816
+
817
+ const DECLARATIONS = [
818
+ NggModalComponent,
819
+ NggModalHeaderComponent,
820
+ NggModalBodyComponent,
821
+ NggModalFooterComponent
822
+ ];
823
+ const EXPORTS = [
824
+ NggModalComponent,
825
+ ];
826
+ class NggModalModule {
827
+ }
828
+ NggModalModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggModalModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
829
+ NggModalModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggModalModule, declarations: [NggModalComponent,
830
+ NggModalHeaderComponent,
831
+ NggModalBodyComponent,
832
+ NggModalFooterComponent], imports: [A11yModule, CommonModule], exports: [NggModalComponent] });
833
+ NggModalModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggModalModule, imports: [[A11yModule, CommonModule]] });
834
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggModalModule, decorators: [{
835
+ type: NgModule,
836
+ args: [{
837
+ imports: [A11yModule, CommonModule],
838
+ exports: EXPORTS,
839
+ declarations: DECLARATIONS,
840
+ }]
841
+ }] });
842
+
843
+ class NggProgressCircleComponent {
844
+ constructor() {
845
+ this._startValue = '0deg';
846
+ this._endValue = '0deg';
847
+ /** id of the progress circle */
848
+ this.id = `progress-circle-${randomId()}`;
849
+ /** theme of the progress circle */
850
+ this.theme = 'warning';
851
+ }
852
+ /** progress circle value in percentage */
853
+ set value(percent) {
854
+ const degrees = this.calculateDegrees(percent);
855
+ this._endValue = `${degrees}deg`;
856
+ }
857
+ calculateDegrees(percent) {
858
+ if (percent > 100) {
859
+ return 180;
860
+ }
861
+ if (percent < 0) {
862
+ return 0;
863
+ }
864
+ /** formula: ((n% * 360deg) / 100% ) / 2 */
865
+ return percent * 1.8;
866
+ }
867
+ }
868
+ NggProgressCircleComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggProgressCircleComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
869
+ NggProgressCircleComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.3", type: NggProgressCircleComponent, selector: "ngg-progress-circle", inputs: { id: "id", theme: "theme", value: "value" }, host: { properties: { "style.--start-value": "this._startValue", "style.--end-value": "this._endValue" } }, ngImport: i0, template: "<div\n class=\"outer-circle\"\n role=\"progressbar\"\n [attr.aria-valuenow]=\"value\"\n [attr.aria-valuemin]=\"0\"\n [attr.aria-valuemax]=\"100\"\n [attr.aria-label]=\"id\"\n>\n <div class=\"ring full-ring\">\n <div class=\"ring-progress\" [ngClass]=\"theme\"></div>\n </div>\n <div class=\"ring\">\n <div class=\"ring-progress\" [ngClass]=\"theme\"></div>\n </div>\n <div class=\"inner-circle\">\n <ng-content></ng-content>\n </div>\n</div>\n", directives: [{ type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] });
870
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggProgressCircleComponent, decorators: [{
871
+ type: Component,
872
+ args: [{ selector: 'ngg-progress-circle', template: "<div\n class=\"outer-circle\"\n role=\"progressbar\"\n [attr.aria-valuenow]=\"value\"\n [attr.aria-valuemin]=\"0\"\n [attr.aria-valuemax]=\"100\"\n [attr.aria-label]=\"id\"\n>\n <div class=\"ring full-ring\">\n <div class=\"ring-progress\" [ngClass]=\"theme\"></div>\n </div>\n <div class=\"ring\">\n <div class=\"ring-progress\" [ngClass]=\"theme\"></div>\n </div>\n <div class=\"inner-circle\">\n <ng-content></ng-content>\n </div>\n</div>\n" }]
873
+ }], propDecorators: { _startValue: [{
874
+ type: HostBinding,
875
+ args: ['style.--start-value']
876
+ }], _endValue: [{
877
+ type: HostBinding,
878
+ args: ['style.--end-value']
879
+ }], id: [{
880
+ type: Input
881
+ }], theme: [{
882
+ type: Input
883
+ }], value: [{
884
+ type: Input
885
+ }] } });
886
+
887
+ class NggProgressCircleModule {
888
+ }
889
+ NggProgressCircleModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggProgressCircleModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
890
+ NggProgressCircleModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggProgressCircleModule, declarations: [NggProgressCircleComponent], imports: [CommonModule], exports: [NggProgressCircleComponent] });
891
+ NggProgressCircleModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggProgressCircleModule, imports: [[CommonModule]] });
892
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggProgressCircleModule, decorators: [{
893
+ type: NgModule,
894
+ args: [{
895
+ declarations: [NggProgressCircleComponent],
896
+ imports: [CommonModule],
897
+ exports: [NggProgressCircleComponent],
898
+ }]
899
+ }] });
900
+
901
+ class NggSegmentedControlComponent {
902
+ }
903
+ NggSegmentedControlComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggSegmentedControlComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
904
+ NggSegmentedControlComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.3", type: NggSegmentedControlComponent, selector: "ngg-segmented-control", inputs: { $controls: "$controls" }, ngImport: i0, template: `
905
+ <div class="group">
906
+ <a
907
+ *ngFor="let control of $controls | async"
908
+ [routerLink]="control.url"
909
+ routerLinkActive="active"
910
+ class="button"
911
+ >{{ control.text }}</a
912
+ >
913
+ </div>
914
+ `, isInline: true, directives: [{ type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i2$1.RouterLinkWithHref, selector: "a[routerLink],area[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "preserveFragment", "skipLocationChange", "replaceUrl", "state", "relativeTo", "routerLink"] }, { type: i2$1.RouterLinkActive, selector: "[routerLinkActive]", inputs: ["routerLinkActiveOptions", "routerLinkActive"], outputs: ["isActiveChange"], exportAs: ["routerLinkActive"] }], pipes: { "async": i2.AsyncPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush });
915
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggSegmentedControlComponent, decorators: [{
916
+ type: Component,
917
+ args: [{
918
+ selector: 'ngg-segmented-control',
919
+ template: `
920
+ <div class="group">
921
+ <a
922
+ *ngFor="let control of $controls | async"
923
+ [routerLink]="control.url"
924
+ routerLinkActive="active"
925
+ class="button"
926
+ >{{ control.text }}</a
927
+ >
928
+ </div>
929
+ `,
930
+ styles: [],
931
+ changeDetection: ChangeDetectionStrategy.OnPush,
932
+ }]
933
+ }], propDecorators: { $controls: [{
934
+ type: Input
935
+ }] } });
936
+
937
+ class NggSegmentedControlModule {
938
+ }
939
+ NggSegmentedControlModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggSegmentedControlModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
940
+ NggSegmentedControlModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggSegmentedControlModule, declarations: [NggSegmentedControlComponent], imports: [RouterModule, CommonModule], exports: [NggSegmentedControlComponent] });
941
+ NggSegmentedControlModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggSegmentedControlModule, imports: [[RouterModule, CommonModule]] });
942
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggSegmentedControlModule, decorators: [{
943
+ type: NgModule,
944
+ args: [{
945
+ declarations: [NggSegmentedControlComponent],
946
+ imports: [RouterModule, CommonModule],
947
+ exports: [NggSegmentedControlComponent],
948
+ }]
949
+ }] });
950
+
951
+ class NggButtonComponent {
952
+ get classes() {
953
+ return [this.variant, this.size ? this.size : false].filter(Boolean).join(" ");
954
+ }
955
+ }
956
+ NggButtonComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
957
+ NggButtonComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.3", type: NggButtonComponent, selector: "[ngg-button]", inputs: { variant: "variant", size: "size" }, host: { properties: { "class": "this.classes" } }, ngImport: i0, template: `<ng-content></ng-content>`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
958
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggButtonComponent, decorators: [{
959
+ type: Component,
960
+ args: [{
961
+ // eslint-disable-next-line @angular-eslint/component-selector
962
+ selector: '[ngg-button]',
963
+ template: `<ng-content></ng-content>`,
964
+ changeDetection: ChangeDetectionStrategy.OnPush
965
+ }]
966
+ }], propDecorators: { variant: [{
967
+ type: Input
968
+ }], size: [{
969
+ type: Input
970
+ }], classes: [{
971
+ type: HostBinding,
972
+ args: ['class']
973
+ }] } });
974
+
975
+ class NggButtonModule {
976
+ }
977
+ NggButtonModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggButtonModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
978
+ NggButtonModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggButtonModule, declarations: [NggButtonComponent], imports: [CommonModule], exports: [NggButtonComponent] });
979
+ NggButtonModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggButtonModule, imports: [[CommonModule]] });
980
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggButtonModule, decorators: [{
981
+ type: NgModule,
982
+ args: [{
983
+ declarations: [NggButtonComponent],
984
+ imports: [CommonModule],
985
+ exports: [NggButtonComponent],
986
+ }]
987
+ }] });
988
+
485
989
  class NggModule {
486
990
  }
487
- NggModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: NggModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
488
- NggModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: NggModule, imports: [CommonModule], exports: [NggSegmentedControlModule, NggDropdownModule, NggDatepickerModule] });
489
- NggModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: NggModule, imports: [[CommonModule], NggSegmentedControlModule, NggDropdownModule, NggDatepickerModule] });
490
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: NggModule, decorators: [{
991
+ NggModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
992
+ NggModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggModule, imports: [CommonModule], exports: [NggAccordionModule,
993
+ NggBadgeModule,
994
+ NggButtonModule,
995
+ NggDatepickerModule,
996
+ NggDropdownModule,
997
+ NggModalModule,
998
+ NggProgressCircleModule,
999
+ NggSegmentedControlModule] });
1000
+ NggModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggModule, imports: [[CommonModule], NggAccordionModule,
1001
+ NggBadgeModule,
1002
+ NggButtonModule,
1003
+ NggDatepickerModule,
1004
+ NggDropdownModule,
1005
+ NggModalModule,
1006
+ NggProgressCircleModule,
1007
+ NggSegmentedControlModule] });
1008
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggModule, decorators: [{
491
1009
  type: NgModule,
492
1010
  args: [{
493
1011
  declarations: [],
494
1012
  imports: [CommonModule],
495
- exports: [NggSegmentedControlModule, NggDropdownModule, NggDatepickerModule],
1013
+ exports: [
1014
+ NggAccordionModule,
1015
+ NggBadgeModule,
1016
+ NggButtonModule,
1017
+ NggDatepickerModule,
1018
+ NggDropdownModule,
1019
+ NggModalModule,
1020
+ NggProgressCircleModule,
1021
+ NggSegmentedControlModule,
1022
+ ],
496
1023
  }]
497
1024
  }] });
498
1025
 
@@ -500,5 +1027,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.2", ngImpor
500
1027
  * Generated bundle index. Do not edit.
501
1028
  */
502
1029
 
503
- export { NggDatepickerComponent, NggDatepickerModule, NggDropdownComponent, NggDropdownModule, NggModule, NggSegmentedControlComponent, NggSegmentedControlModule };
1030
+ export { NggAccordionComponent, NggAccordionListItemComponent, NggAccordionModule, NggBadgeComponent, NggBadgeModule, NggButtonComponent, NggButtonModule, NggDatepickerComponent, NggDatepickerModule, NggDropdownComponent, NggDropdownModule, NggDropdownOptionDirective, NggModalBodyComponent, NggModalComponent, NggModalFooterComponent, NggModalHeaderComponent, NggModalModule, NggModule, NggProgressCircleComponent, NggProgressCircleModule, NggSegmentedControlComponent, NggSegmentedControlModule, dateValidator };
504
1031
  //# sourceMappingURL=sebgroup-green-angular.mjs.map