@sebgroup/green-angular 1.0.0-beta.9 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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 +71 -18
  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 +798 -268
  30. package/fesm2015/sebgroup-green-angular.mjs.map +1 -1
  31. package/fesm2020/sebgroup-green-angular.mjs +784 -264
  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 +14 -10
  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,99 +1,302 @@
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 { disableBodyScroll, enableBodyScroll } from 'body-scroll-lock';
9
+ import * as i1 from '@angular/cdk/a11y';
10
+ import { A11yModule } from '@angular/cdk/a11y';
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
+ var _a, _b;
66
+ if (value === this._expandAll)
67
+ return;
68
+ if (this._expandAll) {
69
+ (_a = this.expandAllSubscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
70
+ }
71
+ this._expandAll = value;
72
+ this.expandAllSubscription = (_b = this._expandAll) === null || _b === void 0 ? void 0 : _b.subscribe(() => {
73
+ if (this.closeOthers === false) {
74
+ const itemArray = this.items ? Array.from(this.items) : undefined;
75
+ if (itemArray) {
76
+ for (const i of itemArray) {
77
+ i.expand();
78
+ }
79
+ }
80
+ }
81
+ });
82
+ }
83
+ ngAfterContentChecked() {
84
+ if (this.closeOthers) {
85
+ const itemArray = this.items ? Array.from(this.items) : undefined;
86
+ if (itemArray) {
87
+ for (const i of itemArray) {
88
+ i.expandedChange.subscribe((child) => this.onChildExpanded(child));
89
+ }
90
+ }
91
+ }
92
+ }
93
+ ngOnDestroy() {
94
+ var _a;
95
+ if (this.closeOthers) {
96
+ const itemArray = this.items ? Array.from(this.items) : undefined;
97
+ if (itemArray) {
98
+ for (const i of itemArray) {
99
+ i.expandedChange.unsubscribe();
100
+ }
101
+ }
102
+ }
103
+ (_a = this.expandAllSubscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
104
+ }
105
+ onChildExpanded(childIdentity) {
106
+ if (this.closeOthers && childIdentity.isExpanded && this.items) {
107
+ this.items.forEach((item) => {
108
+ if (item !== childIdentity)
109
+ item.shrink();
110
+ });
111
+ }
112
+ }
113
+ }
114
+ NggAccordionComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggAccordionComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
115
+ 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" });
116
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggAccordionComponent, decorators: [{
25
117
  type: Component,
118
+ args: [{ selector: "ngg-accordion", template: "<div class=\"accordion\" data-testid=\"accordion-root\">\n <ng-content></ng-content>\n</div>\n" }]
119
+ }], propDecorators: { items: [{
120
+ type: ContentChildren,
121
+ args: [NggAccordionListItemComponent]
122
+ }], closeOthers: [{
123
+ type: Input
124
+ }], expandAll: [{
125
+ type: Input
126
+ }] } });
127
+
128
+ class NggAccordionModule {
129
+ }
130
+ NggAccordionModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggAccordionModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
131
+ NggAccordionModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggAccordionModule, declarations: [NggAccordionListItemComponent, NggAccordionComponent], imports: [CommonModule], exports: [NggAccordionListItemComponent, NggAccordionComponent] });
132
+ NggAccordionModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggAccordionModule, imports: [[CommonModule]] });
133
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggAccordionModule, decorators: [{
134
+ type: NgModule,
26
135
  args: [{
27
- selector: 'ngg-segmented-control',
136
+ imports: [CommonModule],
137
+ exports: [NggAccordionListItemComponent, NggAccordionComponent],
138
+ declarations: [NggAccordionListItemComponent, NggAccordionComponent]
139
+ }]
140
+ }] });
141
+
142
+ class NggBadgeComponent {
143
+ //eslint-disable-next-line
144
+ constructor() {
145
+ /** The color of the component */
146
+ this.badgeType = '';
147
+ /** Callback when component is dismissed */
148
+ this.handleClose = new EventEmitter();
149
+ }
150
+ /** Flag whether the component can be dismissed */
151
+ set isCloseable(value) {
152
+ this._isCloseable = value;
153
+ }
154
+ get isCloseable() {
155
+ return this._isCloseable === '' || !!this._isCloseable;
156
+ }
157
+ get class() {
158
+ return ['badge', this.badgeType].join(' ');
159
+ }
160
+ ngOnInit() {
161
+ if (!!this.customColor || !!this.customBackgroundColor) {
162
+ this.badgeType = '';
163
+ }
164
+ }
165
+ close(e) {
166
+ this.handleClose.emit(e);
167
+ }
168
+ }
169
+ NggBadgeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggBadgeComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
170
+ 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: `
171
+ <strong>
172
+ <ng-content></ng-content>
173
+ </strong>
174
+ <button *ngIf="isCloseable" class="close" (click)="close($event)">
175
+ {{ closeText }}
176
+ <i></i>
177
+ </button>
178
+ `, isInline: true, directives: [{ type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
179
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggBadgeComponent, decorators: [{
180
+ type: Component,
181
+ args: [{
182
+ // we need to disable this warning since we don't want the badge component to create a new element
183
+ // eslint-disable-next-line @angular-eslint/component-selector
184
+ selector: '[ngg-badge]',
28
185
  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>
186
+ <strong>
187
+ <ng-content></ng-content>
188
+ </strong>
189
+ <button *ngIf="isCloseable" class="close" (click)="close($event)">
190
+ {{ closeText }}
191
+ <i></i>
192
+ </button>
38
193
  `,
39
- styles: [],
40
194
  changeDetection: ChangeDetectionStrategy.OnPush,
41
195
  }]
42
- }], propDecorators: { $controls: [{
196
+ }], ctorParameters: function () { return []; }, propDecorators: { badgeType: [{
197
+ type: Input
198
+ }], isCloseable: [{
199
+ type: Input
200
+ }], closeText: [{
43
201
  type: Input
202
+ }], customColor: [{
203
+ type: HostBinding,
204
+ args: ['style.color']
205
+ }, {
206
+ type: Input
207
+ }], customBackgroundColor: [{
208
+ type: HostBinding,
209
+ args: ['style.background-color']
210
+ }, {
211
+ type: Input
212
+ }], class: [{
213
+ type: HostBinding,
214
+ args: ['class']
215
+ }], handleClose: [{
216
+ type: Output
44
217
  }] } });
45
218
 
46
- class NggSegmentedControlModule {
219
+ class NggBadgeModule {
47
220
  }
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: [{
221
+ NggBadgeModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggBadgeModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
222
+ NggBadgeModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggBadgeModule, declarations: [NggBadgeComponent], imports: [CommonModule], exports: [NggBadgeComponent] });
223
+ NggBadgeModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggBadgeModule, imports: [[CommonModule]] });
224
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggBadgeModule, decorators: [{
52
225
  type: NgModule,
53
226
  args: [{
54
- declarations: [NggSegmentedControlComponent],
55
- imports: [RouterModule, CommonModule],
56
- exports: [NggSegmentedControlComponent],
227
+ declarations: [NggBadgeComponent],
228
+ imports: [CommonModule],
229
+ exports: [NggBadgeComponent],
57
230
  }]
58
231
  }] });
59
232
 
233
+ class NggDropdownOptionDirective {
234
+ constructor(templateRef) {
235
+ this.templateRef = templateRef;
236
+ }
237
+ }
238
+ NggDropdownOptionDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggDropdownOptionDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
239
+ NggDropdownOptionDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.3", type: NggDropdownOptionDirective, selector: "[nggDropdownOption]", ngImport: i0 });
240
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggDropdownOptionDirective, decorators: [{
241
+ type: Directive,
242
+ args: [{
243
+ selector: '[nggDropdownOption]',
244
+ }]
245
+ }], ctorParameters: function () { return [{ type: i0.TemplateRef }]; } });
246
+
60
247
  class NggDropdownComponent {
61
- constructor(cd) {
62
- var _a, _b;
248
+ constructor(cd, injector) {
249
+ var _a, _b, _c;
63
250
  this.cd = cd;
251
+ this.injector = injector;
64
252
  this.loop = false;
65
253
  this.options = [];
254
+ this._multiSelect = false;
255
+ this._searchable = false;
66
256
  this.valueChange = new EventEmitter();
67
- this.toggler = (_a = dropdownValues.elements) === null || _a === void 0 ? void 0 : _a.toggler;
68
- this.listbox = (_b = dropdownValues.elements) === null || _b === void 0 ? void 0 : _b.listbox;
257
+ this.touched = new EventEmitter();
258
+ this.toggler = (_a = dropdownValues().elements) === null || _a === void 0 ? void 0 : _a.toggler;
259
+ this.listbox = (_b = dropdownValues().elements) === null || _b === void 0 ? void 0 : _b.listbox;
260
+ this.fieldset = (_c = dropdownValues().elements) === null || _c === void 0 ? void 0 : _c.fieldset;
69
261
  this.trackByKey = (index, option) => {
70
- return option.key;
262
+ var _a;
263
+ return (_a = option.attributes.id) !== null && _a !== void 0 ? _a : '';
71
264
  };
72
265
  }
266
+ set multiSelect(value) {
267
+ this._multiSelect = this.convertToBoolean(value);
268
+ }
269
+ get multiSelect() {
270
+ return this._multiSelect;
271
+ }
272
+ set searchable(value) {
273
+ this._searchable = this.convertToBoolean(value);
274
+ }
275
+ get searchable() {
276
+ return this._searchable;
277
+ }
278
+ set value(newValue) {
279
+ var _a;
280
+ (_a = this.handler) === null || _a === void 0 ? void 0 : _a.selectByValue(newValue);
281
+ this._value = newValue;
282
+ }
73
283
  get value() {
74
284
  return this._value;
75
285
  }
76
- set value(newValue) {
77
- this.setSelectionByValue(newValue);
286
+ get control() {
287
+ return this.injector.get(NgControl);
78
288
  }
79
289
  ngAfterViewInit() {
80
- var _a, _b;
290
+ var _a, _b, _c;
81
291
  if (((_a = this.togglerRef) === null || _a === void 0 ? void 0 : _a.nativeElement) && ((_b = this.listboxRef) === null || _b === void 0 ? void 0 : _b.nativeElement)) {
82
- this.handler = createDropdown(this.props, this.togglerRef.nativeElement, this.listboxRef.nativeElement, (dropdown) => {
83
- var _a;
292
+ this.handler = createDropdown(this.props, this.togglerRef.nativeElement, this.listboxRef.nativeElement, (_c = this.fieldsetRef) === null || _c === void 0 ? void 0 : _c.nativeElement, (dropdown) => {
84
293
  this.dropdown = dropdown;
85
294
  this.toggler = dropdown.elements.toggler;
86
295
  this.listbox = dropdown.elements.listbox;
87
- const selected = (_a = this.dropdown.options) === null || _a === void 0 ? void 0 : _a.find((option) => option.selected);
88
- if (selected && this._value !== (selected === null || selected === void 0 ? void 0 : selected.value)) {
89
- setTimeout(() => {
90
- this._value = selected.value;
91
- this.valueChange.emit(selected.value);
92
- this.onChangeFn && this.onChangeFn(selected.value);
93
- this.onTouchedFn && this.onTouchedFn();
94
- }, 0);
95
- }
296
+ this.fieldset = dropdown.elements.fieldset;
96
297
  this.cd.detectChanges();
298
+ }, (value) => {
299
+ this.updateValue(value);
97
300
  });
98
301
  }
99
302
  }
@@ -103,7 +306,7 @@ class NggDropdownComponent {
103
306
  }
104
307
  ngOnChanges(changes) {
105
308
  if (this.handler &&
106
- (changes.id || changes.text || changes.loop || changes.options)) {
309
+ (changes.id || changes.texts || changes.loop || changes.options)) {
107
310
  this.handler.update(this.props);
108
311
  }
109
312
  }
@@ -116,204 +319,74 @@ class NggDropdownComponent {
116
319
  registerOnTouched(fn) {
117
320
  this.onTouchedFn = fn;
118
321
  }
119
- select(option) {
322
+ search($event) {
120
323
  var _a;
121
- (_a = this.handler) === null || _a === void 0 ? void 0 : _a.select(option);
122
- this._value = option.value;
123
- this.valueChange.emit(option.value);
124
- this.onChangeFn && this.onChangeFn(option.value);
125
- this.onTouchedFn && this.onTouchedFn();
324
+ (_a = this.handler) === null || _a === void 0 ? void 0 : _a.search($event.target.value);
126
325
  }
127
326
  get props() {
128
327
  var _a;
129
328
  return {
130
329
  id: this.id || ((_a = this.dropdown) === null || _a === void 0 ? void 0 : _a.id),
131
- text: this.text,
330
+ texts: this.texts,
331
+ useValue: this.useValue,
332
+ display: this.display,
132
333
  options: this.options,
133
334
  loop: this.loop,
134
335
  value: this.value,
336
+ multiSelect: this.multiSelect,
337
+ searchable: this.searchable,
338
+ searchFilter: this.searchFilter,
339
+ compareWith: this.compareWith,
340
+ onTouched: () => {
341
+ var _a;
342
+ (_a = this.onTouchedFn) === null || _a === void 0 ? void 0 : _a.call(this);
343
+ this.touched.emit(true);
344
+ this.cd.markForCheck();
345
+ },
135
346
  };
136
347
  }
137
- setSelectionByValue(value) {
138
- var _a, _b, _c;
139
- if (this._value !== value) {
140
- this._value = value;
141
- const selected = (_b = (_a = this.handler) === null || _a === void 0 ? void 0 : _a.dropdown) === null || _b === void 0 ? void 0 : _b.options.find((option) => option.value === value);
142
- if (selected)
143
- (_c = this.handler) === null || _c === void 0 ? void 0 : _c.select(selected);
144
- }
348
+ updateValue(option) {
349
+ var _a;
350
+ this._value = option;
351
+ this.valueChange.emit(option);
352
+ (_a = this.onChangeFn) === null || _a === void 0 ? void 0 : _a.call(this, option);
353
+ }
354
+ convertToBoolean(value) {
355
+ return (value === '' || value === 'true' || value.toString() === 'true' || false);
145
356
  }
146
357
  }
147
- NggDropdownComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: NggDropdownComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
148
- 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: [
358
+ 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 });
359
+ 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: [
149
360
  {
150
361
  provide: NG_VALUE_ACCESSOR,
151
362
  useExisting: NggDropdownComponent,
152
363
  multi: true,
153
364
  },
154
- ], viewQueries: [{ propertyName: "togglerRef", first: true, predicate: ["togglerRef"], descendants: true }, { propertyName: "listboxRef", first: true, predicate: ["listboxRef"], descendants: true }], usesOnChanges: true, ngImport: i0, template: `
155
- <div>
156
- <span
157
- class="label"
158
- *ngIf="label"
159
- [id]="toggler?.attributes?.id + '_label'"
160
- >{{ label }}</span
161
- >
162
- <button
163
- [attr.aria-labelledby]="
164
- label ? toggler?.attributes?.id + '_label' : null
165
- "
166
- [attr.aria-describedby]="
167
- formInfo?.innerText && formInfo.innerText.length > 0
168
- ? toggler?.attributes?.id + '_info'
169
- : null
170
- "
171
- type="button"
172
- #togglerRef
173
- [id]="toggler?.attributes?.id"
174
- [attr.aria-haspopup]="toggler?.attributes?.['aria-haspopup']"
175
- [attr.aria-expanded]="toggler?.attributes?.['aria-expanded']"
176
- [attr.aria-owns]="toggler?.attributes?.['aria-owns']"
177
- [tabindex]="toggler?.attributes?.tabIndex"
178
- [style]="toggler?.attributes?.style"
179
- [class]="toggler?.classes"
180
- (click)="handler?.toggle()"
181
- [class.is-valid]="valid"
182
- [class.is-invalid]="invalid"
183
- >
184
- <span>{{ dropdown?.text }}</span>
185
- </button>
186
- <span
187
- class="form-info"
188
- #formInfo
189
- [attr.id]="toggler?.attributes?.id + '_info'"
190
- ><ng-content select="[data-form-info]"></ng-content
191
- ></span>
192
- <div
193
- #listboxRef
194
- [id]="listbox?.attributes?.id"
195
- [attr.role]="listbox?.attributes?.role"
196
- [attr.aria-activedescendant]="
197
- listbox?.attributes?.['aria-activedescendant']
198
- "
199
- [tabindex]="listbox?.attributes?.tabIndex"
200
- [style]="listbox?.attributes?.style"
201
- [class]="listbox?.classes"
202
- >
203
- <button
204
- type="button"
205
- class="close m-4 m-sm-2 d-block d-sm-none"
206
- (click)="handler?.close()"
207
- >
208
- <span class="sr-only">Close</span>
209
- </button>
210
- <ul role="listbox">
211
- <li
212
- *ngFor="let option of dropdown?.options; trackBy: trackByKey"
213
- [id]="option.attributes.id"
214
- [attr.role]="option.attributes.role"
215
- [attr.aria-selected]="option.attributes['aria-selected']"
216
- [style]="option.attributes.style"
217
- [class]="option.classes"
218
- (click)="handler?.select(option)"
219
- >
220
- {{ option.key }}
221
- </li>
222
- </ul>
223
- </div>
224
- </div>
225
- `, 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 });
226
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: NggDropdownComponent, decorators: [{
365
+ ], 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 });
366
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggDropdownComponent, decorators: [{
227
367
  type: Component,
228
- args: [{
229
- selector: 'ngg-dropdown',
230
- template: `
231
- <div>
232
- <span
233
- class="label"
234
- *ngIf="label"
235
- [id]="toggler?.attributes?.id + '_label'"
236
- >{{ label }}</span
237
- >
238
- <button
239
- [attr.aria-labelledby]="
240
- label ? toggler?.attributes?.id + '_label' : null
241
- "
242
- [attr.aria-describedby]="
243
- formInfo?.innerText && formInfo.innerText.length > 0
244
- ? toggler?.attributes?.id + '_info'
245
- : null
246
- "
247
- type="button"
248
- #togglerRef
249
- [id]="toggler?.attributes?.id"
250
- [attr.aria-haspopup]="toggler?.attributes?.['aria-haspopup']"
251
- [attr.aria-expanded]="toggler?.attributes?.['aria-expanded']"
252
- [attr.aria-owns]="toggler?.attributes?.['aria-owns']"
253
- [tabindex]="toggler?.attributes?.tabIndex"
254
- [style]="toggler?.attributes?.style"
255
- [class]="toggler?.classes"
256
- (click)="handler?.toggle()"
257
- [class.is-valid]="valid"
258
- [class.is-invalid]="invalid"
259
- >
260
- <span>{{ dropdown?.text }}</span>
261
- </button>
262
- <span
263
- class="form-info"
264
- #formInfo
265
- [attr.id]="toggler?.attributes?.id + '_info'"
266
- ><ng-content select="[data-form-info]"></ng-content
267
- ></span>
268
- <div
269
- #listboxRef
270
- [id]="listbox?.attributes?.id"
271
- [attr.role]="listbox?.attributes?.role"
272
- [attr.aria-activedescendant]="
273
- listbox?.attributes?.['aria-activedescendant']
274
- "
275
- [tabindex]="listbox?.attributes?.tabIndex"
276
- [style]="listbox?.attributes?.style"
277
- [class]="listbox?.classes"
278
- >
279
- <button
280
- type="button"
281
- class="close m-4 m-sm-2 d-block d-sm-none"
282
- (click)="handler?.close()"
283
- >
284
- <span class="sr-only">Close</span>
285
- </button>
286
- <ul role="listbox">
287
- <li
288
- *ngFor="let option of dropdown?.options; trackBy: trackByKey"
289
- [id]="option.attributes.id"
290
- [attr.role]="option.attributes.role"
291
- [attr.aria-selected]="option.attributes['aria-selected']"
292
- [style]="option.attributes.style"
293
- [class]="option.classes"
294
- (click)="handler?.select(option)"
295
- >
296
- {{ option.key }}
297
- </li>
298
- </ul>
299
- </div>
300
- </div>
301
- `,
302
- providers: [
368
+ args: [{ selector: 'ngg-dropdown', providers: [
303
369
  {
304
370
  provide: NG_VALUE_ACCESSOR,
305
371
  useExisting: NggDropdownComponent,
306
372
  multi: true,
307
373
  },
308
- ],
309
- changeDetection: ChangeDetectionStrategy.OnPush,
310
- }]
311
- }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { id: [{
374
+ ], 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" }]
375
+ }], ctorParameters: function () {
376
+ return [{ type: i0.ChangeDetectorRef }, { type: i0.Injector, decorators: [{
377
+ type: Inject,
378
+ args: [Injector]
379
+ }] }];
380
+ }, propDecorators: { id: [{
312
381
  type: Input
313
- }], text: [{
382
+ }], texts: [{
314
383
  type: Input
315
384
  }], loop: [{
316
385
  type: Input
386
+ }], display: [{
387
+ type: Input
388
+ }], useValue: [{
389
+ type: Input
317
390
  }], label: [{
318
391
  type: Input
319
392
  }], options: [{
@@ -322,52 +395,62 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.2", ngImpor
322
395
  type: Input
323
396
  }], invalid: [{
324
397
  type: Input
398
+ }], compareWith: [{
399
+ type: Input
400
+ }], searchFilter: [{
401
+ type: Input
402
+ }], multiSelect: [{
403
+ type: Input
404
+ }], searchable: [{
405
+ type: Input
325
406
  }], value: [{
326
407
  type: Input
327
408
  }], valueChange: [{
328
409
  type: Output
410
+ }], touched: [{
411
+ type: Output
329
412
  }], togglerRef: [{
330
413
  type: ViewChild,
331
414
  args: ['togglerRef']
332
415
  }], listboxRef: [{
333
416
  type: ViewChild,
334
417
  args: ['listboxRef']
418
+ }], fieldsetRef: [{
419
+ type: ViewChild,
420
+ args: ['fieldsetRef']
421
+ }], customOption: [{
422
+ type: ContentChild,
423
+ args: [NggDropdownOptionDirective]
335
424
  }] } });
336
425
 
337
- class NggDropdownModule {
338
- }
339
- NggDropdownModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: NggDropdownModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
340
- NggDropdownModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: NggDropdownModule, declarations: [NggDropdownComponent], imports: [CommonModule], exports: [NggDropdownComponent] });
341
- NggDropdownModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: NggDropdownModule, imports: [[CommonModule]] });
342
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: NggDropdownModule, decorators: [{
343
- type: NgModule,
344
- args: [{
345
- declarations: [NggDropdownComponent],
346
- imports: [CommonModule],
347
- exports: [NggDropdownComponent],
348
- }]
349
- }] });
350
-
351
426
  class NggDatepickerComponent {
352
427
  constructor(_cdr) {
353
428
  this._cdr = _cdr;
354
429
  this.id = randomId();
430
+ this.isValid = null;
355
431
  this.valueChange = new EventEmitter();
356
432
  this._months = months({});
357
- this.years = years({});
358
- this.trackByKey = (index, option) => {
359
- return option.key;
360
- };
361
433
  this.listener = (data, state) => {
434
+ var _a, _b, _c, _d, _e;
362
435
  if (this.dp && state) {
363
436
  this.dp.state = Object.assign({}, state);
437
+ this.years = years({
438
+ from: (_b = (_a = this.dp.state) === null || _a === void 0 ? void 0 : _a.minDate) === null || _b === void 0 ? void 0 : _b.getFullYear(),
439
+ to: (_d = (_c = this.dp.state) === null || _c === void 0 ? void 0 : _c.maxDate) === null || _d === void 0 ? void 0 : _d.getFullYear(),
440
+ });
364
441
  }
365
442
  this.onTouchedFn && this.onTouchedFn();
366
443
  if (data) {
367
- this.valueChange.emit(data.selectedDate);
368
- this.onChangeFn && this.onChangeFn(data.selectedDate);
444
+ // only emit change event if date has changed
445
+ if (((_e = this.data) === null || _e === void 0 ? void 0 : _e.selectedDate) !== data.selectedDate) {
446
+ this.valueChange.emit(data.selectedDate);
447
+ this.onChangeFn && this.onChangeFn(data.selectedDate);
448
+ }
369
449
  this.data = data;
370
450
  }
451
+ if (data || state) {
452
+ this._cdr.markForCheck();
453
+ }
371
454
  };
372
455
  }
373
456
  get months() {
@@ -415,6 +498,18 @@ class NggDatepickerComponent {
415
498
  set data(value) {
416
499
  this._data = value;
417
500
  }
501
+ onDateChange(value) {
502
+ var _a;
503
+ const newDate = new Date(value);
504
+ // Only pass valid date to date picker
505
+ if (!isNaN(newDate.getTime())) {
506
+ (_a = this.dp) === null || _a === void 0 ? void 0 : _a.select(value);
507
+ }
508
+ else {
509
+ this.valueChange.emit(value);
510
+ this.onChangeFn && this.onChangeFn(value);
511
+ }
512
+ }
418
513
  trackWeek(index, week) {
419
514
  return week;
420
515
  }
@@ -423,8 +518,9 @@ class NggDatepickerComponent {
423
518
  if (this.datepickerElRef &&
424
519
  this.datepickerDialogElRef &&
425
520
  this.dateInputElRef &&
521
+ this.datepickerTriggerElRef &&
426
522
  !this.dp) {
427
- this.dp = createDatepicker(this.listener, Object.assign(Object.assign({}, this.options), { selectedDate: this.value }), this.datepickerElRef.nativeElement, this.datepickerDialogElRef.nativeElement, this.dateInputElRef.nativeElement);
523
+ this.dp = createDatepicker(this.listener, Object.assign(Object.assign({}, this.options), { selectedDate: this.value }), this.datepickerElRef.nativeElement, this.datepickerDialogElRef.nativeElement, this.dateInputElRef.nativeElement, this.datepickerTriggerElRef.nativeElement);
428
524
  this._cdr.detectChanges();
429
525
  }
430
526
  else {
@@ -432,15 +528,15 @@ class NggDatepickerComponent {
432
528
  }
433
529
  }
434
530
  }
435
- NggDatepickerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: NggDatepickerComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
436
- 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: [
531
+ NggDatepickerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggDatepickerComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
532
+ 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: [
437
533
  {
438
534
  provide: NG_VALUE_ACCESSOR,
439
535
  useExisting: NggDatepickerComponent,
440
536
  multi: true,
441
537
  },
442
- ], 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 });
443
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: NggDatepickerComponent, decorators: [{
538
+ ], 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 }], 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 });
539
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggDatepickerComponent, decorators: [{
444
540
  type: Component,
445
541
  args: [{ selector: 'ngg-datepicker', providers: [
446
542
  {
@@ -448,7 +544,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.2", ngImpor
448
544
  useExisting: NggDatepickerComponent,
449
545
  multi: true,
450
546
  },
451
- ], 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" }]
547
+ ], 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" }]
452
548
  }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { options: [{
453
549
  type: Input
454
550
  }], value: [{
@@ -457,9 +553,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.2", ngImpor
457
553
  type: Input
458
554
  }], label: [{
459
555
  type: Input
460
- }], valid: [{
461
- type: Input
462
- }], invalid: [{
556
+ }], isValid: [{
463
557
  type: Input
464
558
  }], valueChange: [{
465
559
  type: Output
@@ -472,14 +566,63 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.2", ngImpor
472
566
  }], datepickerElRef: [{
473
567
  type: ViewChild,
474
568
  args: ['datepickerElRef']
569
+ }], datepickerTriggerElRef: [{
570
+ type: ViewChild,
571
+ args: ['datepickerTriggerElRef']
475
572
  }] } });
573
+ function dateValidator(dates) {
574
+ return (control) => {
575
+ const value = control.value;
576
+ if (!value) {
577
+ return null;
578
+ }
579
+ const newDate = new Date(value);
580
+ const isValidDate = !isNaN(newDate.getTime());
581
+ if (!isValidDate) {
582
+ return { validDate: true };
583
+ }
584
+ const validMinDate = (dates === null || dates === void 0 ? void 0 : dates.min) ? newDate >= startOfDay(dates.min) : true;
585
+ const validMaxDate = (dates === null || dates === void 0 ? void 0 : dates.max) ? newDate <= endOfDay(dates.max) : true;
586
+ if (!validMinDate && (dates === null || dates === void 0 ? void 0 : dates.min)) {
587
+ return {
588
+ validDate: {
589
+ minDate: startOfDay(dates.min),
590
+ actualDate: newDate,
591
+ },
592
+ };
593
+ }
594
+ if (!validMaxDate && (dates === null || dates === void 0 ? void 0 : dates.max)) {
595
+ return {
596
+ validDate: {
597
+ maxDate: endOfDay(dates.max),
598
+ actualDate: newDate,
599
+ },
600
+ };
601
+ }
602
+ return null;
603
+ };
604
+ }
605
+
606
+ class NggDropdownModule {
607
+ }
608
+ NggDropdownModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggDropdownModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
609
+ NggDropdownModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggDropdownModule, declarations: [NggDropdownComponent, NggDropdownOptionDirective], imports: [CommonModule], exports: [NggDropdownComponent, NggDropdownOptionDirective] });
610
+ NggDropdownModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggDropdownModule, imports: [[CommonModule]] });
611
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggDropdownModule, decorators: [{
612
+ type: NgModule,
613
+ args: [{
614
+ declarations: [NggDropdownComponent, NggDropdownOptionDirective],
615
+ imports: [CommonModule],
616
+ exports: [NggDropdownComponent, NggDropdownOptionDirective],
617
+ }]
618
+ }] });
476
619
 
477
620
  class NggDatepickerModule {
478
621
  }
479
- NggDatepickerModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: NggDatepickerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
480
- NggDatepickerModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: NggDatepickerModule, declarations: [NggDatepickerComponent], imports: [CommonModule, NggDropdownModule], exports: [NggDatepickerComponent] });
481
- NggDatepickerModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: NggDatepickerModule, imports: [[CommonModule, NggDropdownModule]] });
482
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: NggDatepickerModule, decorators: [{
622
+ NggDatepickerModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggDatepickerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
623
+ NggDatepickerModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggDatepickerModule, declarations: [NggDatepickerComponent], imports: [CommonModule, NggDropdownModule], exports: [NggDatepickerComponent] });
624
+ NggDatepickerModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggDatepickerModule, imports: [[CommonModule, NggDropdownModule]] });
625
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggDatepickerModule, decorators: [{
483
626
  type: NgModule,
484
627
  args: [{
485
628
  declarations: [NggDatepickerComponent],
@@ -488,17 +631,404 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.2", ngImpor
488
631
  }]
489
632
  }] });
490
633
 
634
+ class NggModalComponent {
635
+ constructor(ref, configurableFocusTrapFactory) {
636
+ this.ref = ref;
637
+ this.configurableFocusTrapFactory = configurableFocusTrapFactory;
638
+ this.isOpenChange = new EventEmitter();
639
+ this.closed = new EventEmitter();
640
+ this.confirm = new EventEmitter();
641
+ this.dismiss = new EventEmitter();
642
+ this.configurableFocusTrap = this.configurableFocusTrapFactory.create(this.ref.nativeElement);
643
+ }
644
+ get trapFocus() {
645
+ return this._trapFocus;
646
+ }
647
+ set trapFocus(value) {
648
+ this._trapFocus = value;
649
+ if (value) {
650
+ if (this._isOpen) {
651
+ this.enableFocusTrap();
652
+ }
653
+ }
654
+ else {
655
+ this.disableFocusTrap();
656
+ }
657
+ }
658
+ get isOpen() {
659
+ return this._isOpen;
660
+ }
661
+ set isOpen(value) {
662
+ this._isOpen = value;
663
+ if (value) {
664
+ if (this.trapFocus) {
665
+ this.enableFocusTrap();
666
+ }
667
+ disableBodyScroll(this.ref.nativeElement);
668
+ }
669
+ else {
670
+ this.disableFocusTrap();
671
+ enableBodyScroll(this.ref.nativeElement);
672
+ }
673
+ }
674
+ get open() { return this.isOpen; }
675
+ ngOnInit() {
676
+ if (this._isOpen && this.trapFocus)
677
+ this.enableFocusTrap();
678
+ else
679
+ this.disableFocusTrap();
680
+ }
681
+ handleCloseClick(event) {
682
+ this.closeModal(event);
683
+ }
684
+ handleBackdropClick(event) {
685
+ var _a;
686
+ if (event.target == ((_a = this.backdropRef) === null || _a === void 0 ? void 0 : _a.nativeElement))
687
+ this.closeModal(event);
688
+ }
689
+ handleDismiss(event) {
690
+ this.dismiss.emit(event);
691
+ }
692
+ handleConfirm(event) {
693
+ this.confirm.emit(event);
694
+ }
695
+ closeModal(event) {
696
+ if (this.closed.observers.length > 0) {
697
+ this.closed.emit(event);
698
+ }
699
+ else {
700
+ this.isOpen = false;
701
+ this.isOpenChange.emit(this.isOpen);
702
+ }
703
+ }
704
+ enableFocusTrap() {
705
+ if (this.configurableFocusTrap) {
706
+ this.configurableFocusTrap.enabled = true;
707
+ this.configurableFocusTrap.focusInitialElementWhenReady();
708
+ }
709
+ }
710
+ disableFocusTrap() {
711
+ if (this.configurableFocusTrap) {
712
+ this.configurableFocusTrap.enabled = false;
713
+ }
714
+ }
715
+ ngOnDestroy() {
716
+ var _a;
717
+ (_a = this.configurableFocusTrap) === null || _a === void 0 ? void 0 : _a.destroy();
718
+ enableBodyScroll(this.ref.nativeElement);
719
+ }
720
+ }
721
+ 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 });
722
+ 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 });
723
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggModalComponent, decorators: [{
724
+ type: Component,
725
+ 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"] }]
726
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i1.ConfigurableFocusTrapFactory }]; }, propDecorators: { modalType: [{
727
+ type: Input
728
+ }], header: [{
729
+ type: Input
730
+ }], confirmLabel: [{
731
+ type: Input
732
+ }], dismissLabel: [{
733
+ type: Input
734
+ }], size: [{
735
+ type: Input
736
+ }], trapFocus: [{
737
+ type: Input
738
+ }], isOpen: [{
739
+ type: Input
740
+ }], isOpenChange: [{
741
+ type: Output
742
+ }], closed: [{
743
+ type: Output
744
+ }], confirm: [{
745
+ type: Output
746
+ }], dismiss: [{
747
+ type: Output
748
+ }], open: [{
749
+ type: HostBinding,
750
+ args: ['class.open']
751
+ }], backdropRef: [{
752
+ type: ViewChild,
753
+ args: ['backdrop']
754
+ }] } });
755
+ class NggModalHeaderComponent {
756
+ constructor() {
757
+ this.closed = new EventEmitter();
758
+ }
759
+ handleClose(event) {
760
+ this.closed.emit(event);
761
+ }
762
+ }
763
+ NggModalHeaderComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggModalHeaderComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
764
+ 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: `
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
+ `, 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"] });
771
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggModalHeaderComponent, decorators: [{
772
+ type: Component,
773
+ args: [{ selector: '[ngg-modal-header]', template: `
774
+ <h3 data-testid="modal-header-text">{{header}}</h3>
775
+ <button data-testid="modal-close-button" class="close" (click)="this.handleClose($event)">
776
+ <span className="sr-only">Close</span>
777
+ <i></i>
778
+ </button>
779
+ `, 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
+ }], propDecorators: { header: [{
781
+ type: Input
782
+ }], closed: [{
783
+ type: Output
784
+ }] } });
785
+ class NggModalBodyComponent {
786
+ }
787
+ NggModalBodyComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggModalBodyComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
788
+ 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"] });
789
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggModalBodyComponent, decorators: [{
790
+ type: Component,
791
+ 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"] }]
792
+ }] });
793
+ class NggModalFooterComponent {
794
+ constructor() {
795
+ this.dismiss = new EventEmitter();
796
+ this.confirm = new EventEmitter();
797
+ }
798
+ handleDismiss(event) {
799
+ this.dismiss.emit(event);
800
+ }
801
+ handleConfirm(event) {
802
+ this.confirm.emit(event);
803
+ }
804
+ }
805
+ NggModalFooterComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggModalFooterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
806
+ 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: `
807
+ <button data-testid="modal-dismiss-button" *ngIf="dismissLabel" class="secondary" (click)="this.handleDismiss($event)">{{dismissLabel}}</button>
808
+ <button data-testid="modal-confirm-button" *ngIf="confirmLabel" class="primary" (click)="this.handleConfirm($event)">{{confirmLabel}}</button>
809
+ `, 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"] }] });
810
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggModalFooterComponent, decorators: [{
811
+ type: Component,
812
+ args: [{ selector: '[ngg-modal-footer]', template: `
813
+ <button data-testid="modal-dismiss-button" *ngIf="dismissLabel" class="secondary" (click)="this.handleDismiss($event)">{{dismissLabel}}</button>
814
+ <button data-testid="modal-confirm-button" *ngIf="confirmLabel" class="primary" (click)="this.handleConfirm($event)">{{confirmLabel}}</button>
815
+ `, 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"] }]
816
+ }], propDecorators: { dismissLabel: [{
817
+ type: Input
818
+ }], confirmLabel: [{
819
+ type: Input
820
+ }], dismiss: [{
821
+ type: Output
822
+ }], confirm: [{
823
+ type: Output
824
+ }] } });
825
+
826
+ const DECLARATIONS = [
827
+ NggModalComponent,
828
+ NggModalHeaderComponent,
829
+ NggModalBodyComponent,
830
+ NggModalFooterComponent
831
+ ];
832
+ const EXPORTS = [
833
+ NggModalComponent,
834
+ ];
835
+ class NggModalModule {
836
+ }
837
+ NggModalModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggModalModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
838
+ NggModalModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggModalModule, declarations: [NggModalComponent,
839
+ NggModalHeaderComponent,
840
+ NggModalBodyComponent,
841
+ NggModalFooterComponent], imports: [A11yModule, CommonModule], exports: [NggModalComponent] });
842
+ NggModalModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggModalModule, imports: [[A11yModule, CommonModule]] });
843
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggModalModule, decorators: [{
844
+ type: NgModule,
845
+ args: [{
846
+ imports: [A11yModule, CommonModule],
847
+ exports: EXPORTS,
848
+ declarations: DECLARATIONS,
849
+ }]
850
+ }] });
851
+
852
+ class NggProgressCircleComponent {
853
+ constructor() {
854
+ this._startValue = '0deg';
855
+ this._endValue = '0deg';
856
+ /** id of the progress circle */
857
+ this.id = `progress-circle-${randomId()}`;
858
+ /** theme of the progress circle */
859
+ this.theme = 'warning';
860
+ }
861
+ /** progress circle value in percentage */
862
+ set value(percent) {
863
+ const degrees = this.calculateDegrees(percent);
864
+ this._endValue = `${degrees}deg`;
865
+ }
866
+ calculateDegrees(percent) {
867
+ if (percent > 100) {
868
+ return 180;
869
+ }
870
+ if (percent < 0) {
871
+ return 0;
872
+ }
873
+ /** formula: ((n% * 360deg) / 100% ) / 2 */
874
+ return percent * 1.8;
875
+ }
876
+ }
877
+ NggProgressCircleComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggProgressCircleComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
878
+ 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"] }] });
879
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggProgressCircleComponent, decorators: [{
880
+ type: Component,
881
+ 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" }]
882
+ }], propDecorators: { _startValue: [{
883
+ type: HostBinding,
884
+ args: ['style.--start-value']
885
+ }], _endValue: [{
886
+ type: HostBinding,
887
+ args: ['style.--end-value']
888
+ }], id: [{
889
+ type: Input
890
+ }], theme: [{
891
+ type: Input
892
+ }], value: [{
893
+ type: Input
894
+ }] } });
895
+
896
+ class NggProgressCircleModule {
897
+ }
898
+ NggProgressCircleModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggProgressCircleModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
899
+ NggProgressCircleModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggProgressCircleModule, declarations: [NggProgressCircleComponent], imports: [CommonModule], exports: [NggProgressCircleComponent] });
900
+ NggProgressCircleModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggProgressCircleModule, imports: [[CommonModule]] });
901
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggProgressCircleModule, decorators: [{
902
+ type: NgModule,
903
+ args: [{
904
+ declarations: [NggProgressCircleComponent],
905
+ imports: [CommonModule],
906
+ exports: [NggProgressCircleComponent],
907
+ }]
908
+ }] });
909
+
910
+ class NggSegmentedControlComponent {
911
+ }
912
+ NggSegmentedControlComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggSegmentedControlComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
913
+ NggSegmentedControlComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.3", type: NggSegmentedControlComponent, selector: "ngg-segmented-control", inputs: { $controls: "$controls" }, ngImport: i0, template: `
914
+ <div class="group">
915
+ <a
916
+ *ngFor="let control of $controls | async"
917
+ [routerLink]="control.url"
918
+ routerLinkActive="active"
919
+ class="button"
920
+ >{{ control.text }}</a
921
+ >
922
+ </div>
923
+ `, 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 });
924
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggSegmentedControlComponent, decorators: [{
925
+ type: Component,
926
+ args: [{
927
+ selector: 'ngg-segmented-control',
928
+ template: `
929
+ <div class="group">
930
+ <a
931
+ *ngFor="let control of $controls | async"
932
+ [routerLink]="control.url"
933
+ routerLinkActive="active"
934
+ class="button"
935
+ >{{ control.text }}</a
936
+ >
937
+ </div>
938
+ `,
939
+ styles: [],
940
+ changeDetection: ChangeDetectionStrategy.OnPush,
941
+ }]
942
+ }], propDecorators: { $controls: [{
943
+ type: Input
944
+ }] } });
945
+
946
+ class NggSegmentedControlModule {
947
+ }
948
+ NggSegmentedControlModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggSegmentedControlModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
949
+ NggSegmentedControlModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggSegmentedControlModule, declarations: [NggSegmentedControlComponent], imports: [RouterModule, CommonModule], exports: [NggSegmentedControlComponent] });
950
+ NggSegmentedControlModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggSegmentedControlModule, imports: [[RouterModule, CommonModule]] });
951
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggSegmentedControlModule, decorators: [{
952
+ type: NgModule,
953
+ args: [{
954
+ declarations: [NggSegmentedControlComponent],
955
+ imports: [RouterModule, CommonModule],
956
+ exports: [NggSegmentedControlComponent],
957
+ }]
958
+ }] });
959
+
960
+ class NggButtonComponent {
961
+ get classes() {
962
+ return [this.variant, this.size ? this.size : false].filter(Boolean).join(" ");
963
+ }
964
+ }
965
+ NggButtonComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
966
+ 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 });
967
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggButtonComponent, decorators: [{
968
+ type: Component,
969
+ args: [{
970
+ // eslint-disable-next-line @angular-eslint/component-selector
971
+ selector: '[ngg-button]',
972
+ template: `<ng-content></ng-content>`,
973
+ changeDetection: ChangeDetectionStrategy.OnPush
974
+ }]
975
+ }], propDecorators: { variant: [{
976
+ type: Input
977
+ }], size: [{
978
+ type: Input
979
+ }], classes: [{
980
+ type: HostBinding,
981
+ args: ['class']
982
+ }] } });
983
+
984
+ class NggButtonModule {
985
+ }
986
+ NggButtonModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggButtonModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
987
+ NggButtonModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggButtonModule, declarations: [NggButtonComponent], imports: [CommonModule], exports: [NggButtonComponent] });
988
+ NggButtonModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggButtonModule, imports: [[CommonModule]] });
989
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggButtonModule, decorators: [{
990
+ type: NgModule,
991
+ args: [{
992
+ declarations: [NggButtonComponent],
993
+ imports: [CommonModule],
994
+ exports: [NggButtonComponent],
995
+ }]
996
+ }] });
997
+
491
998
  class NggModule {
492
999
  }
493
- NggModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: NggModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
494
- NggModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: NggModule, imports: [CommonModule], exports: [NggSegmentedControlModule, NggDropdownModule, NggDatepickerModule] });
495
- NggModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: NggModule, imports: [[CommonModule], NggSegmentedControlModule, NggDropdownModule, NggDatepickerModule] });
496
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: NggModule, decorators: [{
1000
+ NggModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1001
+ NggModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggModule, imports: [CommonModule], exports: [NggAccordionModule,
1002
+ NggBadgeModule,
1003
+ NggButtonModule,
1004
+ NggDatepickerModule,
1005
+ NggDropdownModule,
1006
+ NggModalModule,
1007
+ NggProgressCircleModule,
1008
+ NggSegmentedControlModule] });
1009
+ NggModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggModule, imports: [[CommonModule], NggAccordionModule,
1010
+ NggBadgeModule,
1011
+ NggButtonModule,
1012
+ NggDatepickerModule,
1013
+ NggDropdownModule,
1014
+ NggModalModule,
1015
+ NggProgressCircleModule,
1016
+ NggSegmentedControlModule] });
1017
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggModule, decorators: [{
497
1018
  type: NgModule,
498
1019
  args: [{
499
1020
  declarations: [],
500
1021
  imports: [CommonModule],
501
- exports: [NggSegmentedControlModule, NggDropdownModule, NggDatepickerModule],
1022
+ exports: [
1023
+ NggAccordionModule,
1024
+ NggBadgeModule,
1025
+ NggButtonModule,
1026
+ NggDatepickerModule,
1027
+ NggDropdownModule,
1028
+ NggModalModule,
1029
+ NggProgressCircleModule,
1030
+ NggSegmentedControlModule,
1031
+ ],
502
1032
  }]
503
1033
  }] });
504
1034
 
@@ -506,5 +1036,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.2", ngImpor
506
1036
  * Generated bundle index. Do not edit.
507
1037
  */
508
1038
 
509
- export { NggDatepickerComponent, NggDatepickerModule, NggDropdownComponent, NggDropdownModule, NggModule, NggSegmentedControlComponent, NggSegmentedControlModule };
1039
+ export { NggAccordionComponent, NggAccordionListItemComponent, NggAccordionModule, NggBadgeComponent, NggBadgeModule, NggButtonComponent, NggButtonModule, NggDatepickerComponent, NggDatepickerModule, NggDropdownComponent, NggDropdownModule, NggDropdownOptionDirective, NggModalBodyComponent, NggModalComponent, NggModalFooterComponent, NggModalHeaderComponent, NggModalModule, NggModule, NggProgressCircleComponent, NggProgressCircleModule, NggSegmentedControlComponent, NggSegmentedControlModule, dateValidator };
510
1040
  //# sourceMappingURL=sebgroup-green-angular.mjs.map