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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/esm2020/index.mjs +9 -7
  2. package/esm2020/lib/accordion/accordion-list-item.component.mjs +47 -0
  3. package/esm2020/lib/accordion/accordion.component.mjs +72 -0
  4. package/esm2020/lib/accordion/accordion.module.mjs +19 -0
  5. package/esm2020/lib/accordion/index.mjs +4 -0
  6. package/esm2020/lib/badge/badge.component.mjs +80 -0
  7. package/esm2020/lib/badge/badge.module.mjs +18 -0
  8. package/esm2020/lib/badge/index.mjs +3 -0
  9. package/esm2020/lib/button/button.component.mjs +26 -0
  10. package/esm2020/lib/button/button.module.mjs +18 -0
  11. package/esm2020/lib/button/index.mjs +3 -0
  12. package/esm2020/lib/datepicker/datepicker.component.mjs +86 -26
  13. package/esm2020/lib/datepicker/datepicker.module.mjs +4 -4
  14. package/esm2020/lib/datepicker/index.mjs +3 -0
  15. package/esm2020/lib/dropdown/dropdown-option.directive.mjs +16 -0
  16. package/esm2020/lib/dropdown/dropdown.component.mjs +88 -189
  17. package/esm2020/lib/dropdown/dropdown.module.mjs +8 -7
  18. package/esm2020/lib/dropdown/index.mjs +4 -0
  19. package/esm2020/lib/green-angular.module.mjs +36 -8
  20. package/esm2020/lib/modal/index.mjs +3 -0
  21. package/esm2020/lib/modal/modal.component.mjs +196 -0
  22. package/esm2020/lib/modal/modal.module.mjs +31 -0
  23. package/esm2020/lib/progress-circle/index.mjs +3 -0
  24. package/esm2020/lib/progress-circle/progress-circle.component.mjs +48 -0
  25. package/esm2020/lib/progress-circle/progress-circle.module.mjs +18 -0
  26. package/esm2020/lib/segmented-control/index.mjs +3 -0
  27. package/esm2020/lib/segmented-control/segmented-control.component.mjs +3 -3
  28. package/esm2020/lib/segmented-control/segmented-control.module.mjs +4 -4
  29. package/fesm2015/sebgroup-green-angular.mjs +813 -277
  30. package/fesm2015/sebgroup-green-angular.mjs.map +1 -1
  31. package/fesm2020/sebgroup-green-angular.mjs +799 -272
  32. package/fesm2020/sebgroup-green-angular.mjs.map +1 -1
  33. package/index.d.ts +8 -6
  34. package/lib/accordion/accordion-list-item.component.d.ts +15 -0
  35. package/lib/accordion/accordion.component.d.ts +16 -0
  36. package/lib/accordion/accordion.module.d.ts +9 -0
  37. package/lib/accordion/index.d.ts +3 -0
  38. package/lib/badge/badge.component.d.ts +25 -0
  39. package/lib/badge/badge.module.d.ts +8 -0
  40. package/lib/badge/index.d.ts +2 -0
  41. package/lib/button/button.component.d.ts +9 -0
  42. package/lib/button/button.module.d.ts +8 -0
  43. package/lib/button/index.d.ts +2 -0
  44. package/lib/datepicker/datepicker.component.d.ts +18 -12
  45. package/lib/datepicker/index.d.ts +2 -0
  46. package/lib/dropdown/dropdown-option.directive.d.ts +8 -0
  47. package/lib/dropdown/dropdown.component.d.ts +34 -16
  48. package/lib/dropdown/dropdown.module.d.ts +3 -2
  49. package/lib/dropdown/index.d.ts +3 -0
  50. package/lib/green-angular.module.d.ts +9 -4
  51. package/lib/modal/index.d.ts +2 -0
  52. package/lib/modal/modal.component.d.ts +59 -0
  53. package/lib/modal/modal.module.d.ts +9 -0
  54. package/lib/progress-circle/index.d.ts +2 -0
  55. package/lib/progress-circle/progress-circle.component.d.ts +15 -0
  56. package/lib/progress-circle/progress-circle.module.d.ts +8 -0
  57. package/lib/segmented-control/index.d.ts +2 -0
  58. package/package.json +10 -9
@@ -1,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: [{
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
+ }, {
43
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() {
@@ -392,16 +475,13 @@ class NggDatepickerComponent {
392
475
  set value(newValue) {
393
476
  if (newValue !== this._value) {
394
477
  this._value = newValue;
478
+ if (this._value && this.dp) {
479
+ this.dp.select(this._value);
480
+ }
395
481
  }
396
482
  }
397
483
  writeValue(value) {
398
- var _a;
399
484
  this.value = value;
400
- // When binding using ngModel we need to set initial select date
401
- // once we get initial value as it's not available when component is created
402
- if (value && this.dp && !((_a = this.data) === null || _a === void 0 ? void 0 : _a.selectedDate)) {
403
- this.dp.select(value);
404
- }
405
485
  }
406
486
  registerOnChange(fn) {
407
487
  this.onChangeFn = fn;
@@ -415,32 +495,54 @@ class NggDatepickerComponent {
415
495
  set data(value) {
416
496
  this._data = value;
417
497
  }
498
+ onDateChange(value) {
499
+ var _a;
500
+ const newDate = new Date(value);
501
+ // Only pass valid date to date picker
502
+ if (!isNaN(newDate.getTime())) {
503
+ (_a = this.dp) === null || _a === void 0 ? void 0 : _a.select(value);
504
+ }
505
+ else {
506
+ this.valueChange.emit(value);
507
+ this.onChangeFn && this.onChangeFn(value);
508
+ }
509
+ }
418
510
  trackWeek(index, week) {
419
511
  return week;
420
512
  }
513
+ ngOnChanges(changes) {
514
+ //ignore changes until datepicker has been initialised in ngAfterViewInit
515
+ if (!this.dp)
516
+ return;
517
+ if (changes.options) {
518
+ this._createDatepicker();
519
+ }
520
+ }
421
521
  ngAfterViewInit() {
422
- // initialize datepicker
522
+ this._createDatepicker();
523
+ this._cdr.detectChanges();
524
+ }
525
+ _createDatepicker() {
423
526
  if (this.datepickerElRef &&
424
527
  this.datepickerDialogElRef &&
425
528
  this.dateInputElRef &&
426
- !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);
428
- this._cdr.detectChanges();
529
+ this.datepickerTriggerElRef) {
530
+ 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);
429
531
  }
430
532
  else {
431
533
  throw 'Missing one or more elements...';
432
534
  }
433
535
  }
434
536
  }
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: [
537
+ NggDatepickerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggDatepickerComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
538
+ 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
539
  {
438
540
  provide: NG_VALUE_ACCESSOR,
439
541
  useExisting: NggDatepickerComponent,
440
542
  multi: true,
441
543
  },
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: [{
544
+ ], viewQueries: [{ propertyName: "datepickerDialogElRef", first: true, predicate: ["datepickerDialogElRef"], descendants: true }, { propertyName: "dateInputElRef", first: true, predicate: ["dateInputElRef"], descendants: true }, { propertyName: "datepickerElRef", first: true, predicate: ["datepickerElRef"], descendants: true }, { propertyName: "datepickerTriggerElRef", first: true, predicate: ["datepickerTriggerElRef"], descendants: true }], usesOnChanges: true, ngImport: i0, template: "<div class=\"form-group\">\n <label *ngIf=\"label\" [for]=\"id\">{{ label }}</label>\n <div\n class=\"group\"\n #datepickerElRef\n [class.is-valid]=\"isValid\"\n [class.is-invalid]=\"isValid === false\"\n >\n <input\n [attr.id]=\"id\"\n [attr.aria-describedby]=\"\n formInfo?.innerText && formInfo.innerText.length > 0\n ? id + '_info'\n : null\n \"\n type=\"text\"\n placeholder=\"yyyy-mm-dd\"\n #dateInputElRef\n [value]=\"data?.formattedSelectedDate || ''\"\n (change)=\"onDateChange(dateInputElRef.value)\"\n />\n <button\n #datepickerTriggerElRef\n (click)=\"dp?.toggle()\"\n type=\"button\"\n class=\"primary\"\n >\n <i class=\"sg-icon sg-icon-calendar\">Select date</i>\n </button>\n </div>\n <span class=\"form-info\" #formInfo [attr.id]=\"id + '_info'\"\n ><ng-content select=\"[data-form-info]\"></ng-content\n ></span>\n</div>\n<!-- TODO: get or set attributes from within datepicker instance (dp) -->\n<div\n #datepickerDialogElRef\n class=\"popover popover-datepicker\"\n [class.active]=\"dp?.state?.isActive\"\n role=\"dialog\"\n aria-modal=\"true\"\n aria-label=\"Choose Date\"\n>\n <button type=\"button\" class=\"close\" (click)=\"dp?.close()\"><i></i>Close</button>\n <div class=\"sg-date\">\n <header>\n <button type=\"button\" class=\"link\" (click)=\"dp?.sub(1, 'months')\">\n <i class=\"sg-icon sg-icon-previous\">Previous month</i>\n </button>\n <ngg-dropdown\n [options]=\"months\"\n display=\"key\"\n text=\"Select\"\n [value]=\"data?.month\"\n (valueChange)=\"dp?.setMonth($event)\"\n ></ngg-dropdown>\n <ngg-dropdown\n *ngIf=\"years\"\n [options]=\"years\"\n display=\"key\"\n text=\"Select\"\n [value]=\"data?.year\"\n (valueChange)=\"dp?.setYear($event)\"\n ></ngg-dropdown>\n <button type=\"button\" class=\"link\" (click)=\"dp?.add(1, 'months')\">\n <i class=\"sg-icon sg-icon-next\">Next month</i>\n </button>\n </header>\n <main>\n <table role=\"grid\">\n <thead>\n <tr>\n <th\n scope=\"col\"\n *ngFor=\"let header of data?.calendar?.headers\"\n [abbr]=\"header.abbr\"\n [class.sg-week-header]=\"header.type === 'week'\"\n [class.sg-day-header]=\"header.type === 'day'\"\n >\n {{ header.displayText }}\n </th>\n </tr>\n </thead>\n <tbody>\n <tr\n *ngFor=\"\n let week of data?.calendar?.calendarGrid;\n trackBy: trackWeek;\n let i = index\n \"\n >\n <th\n *ngIf=\"data?.calendar?.weekNumbers as weekNumbers\"\n class=\"sg-week-number\"\n >\n {{ weekNumbers[i] }}\n </th>\n <td\n *ngFor=\"let day of week\"\n [attr.data-date]=\"day.formattedDate\"\n [attr.role]=\"day.selected ? 'gridcell' : null\"\n [attr.aria-selected]=\"\n day.selected && !data?.highlightedDate ? true : null\n \"\n [class.disabled]=\"day.disabled\"\n [class.sg-date-today]=\"day.today\"\n [title]=\"day.today ? 'Today' : ''\"\n [tabIndex]=\"\n day.highlighted ||\n (day.selected && !data?.highlightedDate) ||\n (day.today && !data?.highlightedDate && !data?.selectedDate)\n ? 0\n : -1\n \"\n (click)=\"day.currentMonth && dp?.select(day.date)\"\n >\n {{ day.day }}\n </td>\n </tr>\n </tbody>\n </table>\n </main>\n </div>\n</div>\n", components: [{ type: NggDropdownComponent, selector: "ngg-dropdown", inputs: ["id", "texts", "loop", "display", "useValue", "label", "options", "valid", "invalid", "compareWith", "searchFilter", "multiSelect", "searchable", "value"], outputs: ["valueChange", "touched"] }], directives: [{ type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
545
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggDatepickerComponent, decorators: [{
444
546
  type: Component,
445
547
  args: [{ selector: 'ngg-datepicker', providers: [
446
548
  {
@@ -448,7 +550,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.2", ngImpor
448
550
  useExisting: NggDatepickerComponent,
449
551
  multi: true,
450
552
  },
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" }]
553
+ ], 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
554
  }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { options: [{
453
555
  type: Input
454
556
  }], value: [{
@@ -457,9 +559,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.2", ngImpor
457
559
  type: Input
458
560
  }], label: [{
459
561
  type: Input
460
- }], valid: [{
461
- type: Input
462
- }], invalid: [{
562
+ }], isValid: [{
463
563
  type: Input
464
564
  }], valueChange: [{
465
565
  type: Output
@@ -472,14 +572,63 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.2", ngImpor
472
572
  }], datepickerElRef: [{
473
573
  type: ViewChild,
474
574
  args: ['datepickerElRef']
575
+ }], datepickerTriggerElRef: [{
576
+ type: ViewChild,
577
+ args: ['datepickerTriggerElRef']
475
578
  }] } });
579
+ function dateValidator(dates) {
580
+ return (control) => {
581
+ const value = control.value;
582
+ if (!value) {
583
+ return null;
584
+ }
585
+ const newDate = new Date(value);
586
+ const isValidDate = !isNaN(newDate.getTime());
587
+ if (!isValidDate) {
588
+ return { validDate: true };
589
+ }
590
+ const validMinDate = (dates === null || dates === void 0 ? void 0 : dates.min) ? newDate >= startOfDay(dates.min) : true;
591
+ const validMaxDate = (dates === null || dates === void 0 ? void 0 : dates.max) ? newDate <= endOfDay(dates.max) : true;
592
+ if (!validMinDate && (dates === null || dates === void 0 ? void 0 : dates.min)) {
593
+ return {
594
+ validDate: {
595
+ minDate: startOfDay(dates.min),
596
+ actualDate: newDate,
597
+ },
598
+ };
599
+ }
600
+ if (!validMaxDate && (dates === null || dates === void 0 ? void 0 : dates.max)) {
601
+ return {
602
+ validDate: {
603
+ maxDate: endOfDay(dates.max),
604
+ actualDate: newDate,
605
+ },
606
+ };
607
+ }
608
+ return null;
609
+ };
610
+ }
611
+
612
+ class NggDropdownModule {
613
+ }
614
+ NggDropdownModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggDropdownModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
615
+ NggDropdownModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggDropdownModule, declarations: [NggDropdownComponent, NggDropdownOptionDirective], imports: [CommonModule], exports: [NggDropdownComponent, NggDropdownOptionDirective] });
616
+ NggDropdownModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggDropdownModule, imports: [[CommonModule]] });
617
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggDropdownModule, decorators: [{
618
+ type: NgModule,
619
+ args: [{
620
+ declarations: [NggDropdownComponent, NggDropdownOptionDirective],
621
+ imports: [CommonModule],
622
+ exports: [NggDropdownComponent, NggDropdownOptionDirective],
623
+ }]
624
+ }] });
476
625
 
477
626
  class NggDatepickerModule {
478
627
  }
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: [{
628
+ NggDatepickerModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggDatepickerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
629
+ NggDatepickerModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggDatepickerModule, declarations: [NggDatepickerComponent], imports: [CommonModule, NggDropdownModule], exports: [NggDatepickerComponent] });
630
+ NggDatepickerModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggDatepickerModule, imports: [[CommonModule, NggDropdownModule]] });
631
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggDatepickerModule, decorators: [{
483
632
  type: NgModule,
484
633
  args: [{
485
634
  declarations: [NggDatepickerComponent],
@@ -488,17 +637,404 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.2", ngImpor
488
637
  }]
489
638
  }] });
490
639
 
640
+ class NggModalComponent {
641
+ constructor(ref, configurableFocusTrapFactory) {
642
+ this.ref = ref;
643
+ this.configurableFocusTrapFactory = configurableFocusTrapFactory;
644
+ this.isOpenChange = new EventEmitter();
645
+ this.closed = new EventEmitter();
646
+ this.confirm = new EventEmitter();
647
+ this.dismiss = new EventEmitter();
648
+ this.configurableFocusTrap = this.configurableFocusTrapFactory.create(this.ref.nativeElement);
649
+ }
650
+ get trapFocus() {
651
+ return this._trapFocus;
652
+ }
653
+ set trapFocus(value) {
654
+ this._trapFocus = value;
655
+ if (value) {
656
+ if (this._isOpen) {
657
+ this.enableFocusTrap();
658
+ }
659
+ }
660
+ else {
661
+ this.disableFocusTrap();
662
+ }
663
+ }
664
+ get isOpen() {
665
+ return this._isOpen;
666
+ }
667
+ set isOpen(value) {
668
+ this._isOpen = value;
669
+ if (value) {
670
+ if (this.trapFocus) {
671
+ this.enableFocusTrap();
672
+ }
673
+ disableBodyScroll(this.ref.nativeElement);
674
+ }
675
+ else {
676
+ this.disableFocusTrap();
677
+ enableBodyScroll(this.ref.nativeElement);
678
+ }
679
+ }
680
+ get open() { return this.isOpen; }
681
+ ngOnInit() {
682
+ if (this._isOpen && this.trapFocus)
683
+ this.enableFocusTrap();
684
+ else
685
+ this.disableFocusTrap();
686
+ }
687
+ handleCloseClick(event) {
688
+ this.closeModal(event);
689
+ }
690
+ handleBackdropClick(event) {
691
+ var _a;
692
+ if (event.target == ((_a = this.backdropRef) === null || _a === void 0 ? void 0 : _a.nativeElement))
693
+ this.closeModal(event);
694
+ }
695
+ handleDismiss(event) {
696
+ this.dismiss.emit(event);
697
+ }
698
+ handleConfirm(event) {
699
+ this.confirm.emit(event);
700
+ }
701
+ closeModal(event) {
702
+ if (this.closed.observers.length > 0) {
703
+ this.closed.emit(event);
704
+ }
705
+ else {
706
+ this.isOpen = false;
707
+ this.isOpenChange.emit(this.isOpen);
708
+ }
709
+ }
710
+ enableFocusTrap() {
711
+ if (this.configurableFocusTrap) {
712
+ this.configurableFocusTrap.enabled = true;
713
+ this.configurableFocusTrap.focusInitialElementWhenReady();
714
+ }
715
+ }
716
+ disableFocusTrap() {
717
+ if (this.configurableFocusTrap) {
718
+ this.configurableFocusTrap.enabled = false;
719
+ }
720
+ }
721
+ ngOnDestroy() {
722
+ var _a;
723
+ (_a = this.configurableFocusTrap) === null || _a === void 0 ? void 0 : _a.destroy();
724
+ enableBodyScroll(this.ref.nativeElement);
725
+ }
726
+ }
727
+ 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 });
728
+ 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 });
729
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggModalComponent, decorators: [{
730
+ type: Component,
731
+ 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"] }]
732
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i1.ConfigurableFocusTrapFactory }]; }, propDecorators: { modalType: [{
733
+ type: Input
734
+ }], header: [{
735
+ type: Input
736
+ }], confirmLabel: [{
737
+ type: Input
738
+ }], dismissLabel: [{
739
+ type: Input
740
+ }], size: [{
741
+ type: Input
742
+ }], trapFocus: [{
743
+ type: Input
744
+ }], isOpen: [{
745
+ type: Input
746
+ }], isOpenChange: [{
747
+ type: Output
748
+ }], closed: [{
749
+ type: Output
750
+ }], confirm: [{
751
+ type: Output
752
+ }], dismiss: [{
753
+ type: Output
754
+ }], open: [{
755
+ type: HostBinding,
756
+ args: ['class.open']
757
+ }], backdropRef: [{
758
+ type: ViewChild,
759
+ args: ['backdrop']
760
+ }] } });
761
+ class NggModalHeaderComponent {
762
+ constructor() {
763
+ this.closed = new EventEmitter();
764
+ }
765
+ handleClose(event) {
766
+ this.closed.emit(event);
767
+ }
768
+ }
769
+ NggModalHeaderComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggModalHeaderComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
770
+ 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: `
771
+ <h3 data-testid="modal-header-text">{{header}}</h3>
772
+ <button data-testid="modal-close-button" class="close" (click)="this.handleClose($event)">
773
+ <span className="sr-only">Close</span>
774
+ <i></i>
775
+ </button>
776
+ `, 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"] });
777
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggModalHeaderComponent, decorators: [{
778
+ type: Component,
779
+ args: [{ selector: '[ngg-modal-header]', template: `
780
+ <h3 data-testid="modal-header-text">{{header}}</h3>
781
+ <button data-testid="modal-close-button" class="close" (click)="this.handleClose($event)">
782
+ <span className="sr-only">Close</span>
783
+ <i></i>
784
+ </button>
785
+ `, 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"] }]
786
+ }], propDecorators: { header: [{
787
+ type: Input
788
+ }], closed: [{
789
+ type: Output
790
+ }] } });
791
+ class NggModalBodyComponent {
792
+ }
793
+ NggModalBodyComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggModalBodyComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
794
+ 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"] });
795
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggModalBodyComponent, decorators: [{
796
+ type: Component,
797
+ 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"] }]
798
+ }] });
799
+ class NggModalFooterComponent {
800
+ constructor() {
801
+ this.dismiss = new EventEmitter();
802
+ this.confirm = new EventEmitter();
803
+ }
804
+ handleDismiss(event) {
805
+ this.dismiss.emit(event);
806
+ }
807
+ handleConfirm(event) {
808
+ this.confirm.emit(event);
809
+ }
810
+ }
811
+ NggModalFooterComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggModalFooterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
812
+ 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: `
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
+ `, 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"] }] });
816
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggModalFooterComponent, decorators: [{
817
+ type: Component,
818
+ args: [{ selector: '[ngg-modal-footer]', template: `
819
+ <button data-testid="modal-dismiss-button" *ngIf="dismissLabel" class="secondary" (click)="this.handleDismiss($event)">{{dismissLabel}}</button>
820
+ <button data-testid="modal-confirm-button" *ngIf="confirmLabel" class="primary" (click)="this.handleConfirm($event)">{{confirmLabel}}</button>
821
+ `, 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"] }]
822
+ }], propDecorators: { dismissLabel: [{
823
+ type: Input
824
+ }], confirmLabel: [{
825
+ type: Input
826
+ }], dismiss: [{
827
+ type: Output
828
+ }], confirm: [{
829
+ type: Output
830
+ }] } });
831
+
832
+ const DECLARATIONS = [
833
+ NggModalComponent,
834
+ NggModalHeaderComponent,
835
+ NggModalBodyComponent,
836
+ NggModalFooterComponent
837
+ ];
838
+ const EXPORTS = [
839
+ NggModalComponent,
840
+ ];
841
+ class NggModalModule {
842
+ }
843
+ NggModalModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggModalModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
844
+ NggModalModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggModalModule, declarations: [NggModalComponent,
845
+ NggModalHeaderComponent,
846
+ NggModalBodyComponent,
847
+ NggModalFooterComponent], imports: [A11yModule, CommonModule], exports: [NggModalComponent] });
848
+ NggModalModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggModalModule, imports: [[A11yModule, CommonModule]] });
849
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggModalModule, decorators: [{
850
+ type: NgModule,
851
+ args: [{
852
+ imports: [A11yModule, CommonModule],
853
+ exports: EXPORTS,
854
+ declarations: DECLARATIONS,
855
+ }]
856
+ }] });
857
+
858
+ class NggProgressCircleComponent {
859
+ constructor() {
860
+ this._startValue = '0deg';
861
+ this._endValue = '0deg';
862
+ /** id of the progress circle */
863
+ this.id = `progress-circle-${randomId()}`;
864
+ /** theme of the progress circle */
865
+ this.theme = 'warning';
866
+ }
867
+ /** progress circle value in percentage */
868
+ set value(percent) {
869
+ const degrees = this.calculateDegrees(percent);
870
+ this._endValue = `${degrees}deg`;
871
+ }
872
+ calculateDegrees(percent) {
873
+ if (percent > 100) {
874
+ return 180;
875
+ }
876
+ if (percent < 0) {
877
+ return 0;
878
+ }
879
+ /** formula: ((n% * 360deg) / 100% ) / 2 */
880
+ return percent * 1.8;
881
+ }
882
+ }
883
+ NggProgressCircleComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggProgressCircleComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
884
+ 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"] }] });
885
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggProgressCircleComponent, decorators: [{
886
+ type: Component,
887
+ 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" }]
888
+ }], propDecorators: { _startValue: [{
889
+ type: HostBinding,
890
+ args: ['style.--start-value']
891
+ }], _endValue: [{
892
+ type: HostBinding,
893
+ args: ['style.--end-value']
894
+ }], id: [{
895
+ type: Input
896
+ }], theme: [{
897
+ type: Input
898
+ }], value: [{
899
+ type: Input
900
+ }] } });
901
+
902
+ class NggProgressCircleModule {
903
+ }
904
+ NggProgressCircleModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggProgressCircleModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
905
+ NggProgressCircleModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggProgressCircleModule, declarations: [NggProgressCircleComponent], imports: [CommonModule], exports: [NggProgressCircleComponent] });
906
+ NggProgressCircleModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggProgressCircleModule, imports: [[CommonModule]] });
907
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggProgressCircleModule, decorators: [{
908
+ type: NgModule,
909
+ args: [{
910
+ declarations: [NggProgressCircleComponent],
911
+ imports: [CommonModule],
912
+ exports: [NggProgressCircleComponent],
913
+ }]
914
+ }] });
915
+
916
+ class NggSegmentedControlComponent {
917
+ }
918
+ NggSegmentedControlComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggSegmentedControlComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
919
+ NggSegmentedControlComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.3", type: NggSegmentedControlComponent, selector: "ngg-segmented-control", inputs: { $controls: "$controls" }, ngImport: i0, template: `
920
+ <div class="group">
921
+ <a
922
+ *ngFor="let control of $controls | async"
923
+ [routerLink]="control.url"
924
+ routerLinkActive="active"
925
+ class="button"
926
+ >{{ control.text }}</a
927
+ >
928
+ </div>
929
+ `, 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 });
930
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggSegmentedControlComponent, decorators: [{
931
+ type: Component,
932
+ args: [{
933
+ selector: 'ngg-segmented-control',
934
+ template: `
935
+ <div class="group">
936
+ <a
937
+ *ngFor="let control of $controls | async"
938
+ [routerLink]="control.url"
939
+ routerLinkActive="active"
940
+ class="button"
941
+ >{{ control.text }}</a
942
+ >
943
+ </div>
944
+ `,
945
+ styles: [],
946
+ changeDetection: ChangeDetectionStrategy.OnPush,
947
+ }]
948
+ }], propDecorators: { $controls: [{
949
+ type: Input
950
+ }] } });
951
+
952
+ class NggSegmentedControlModule {
953
+ }
954
+ NggSegmentedControlModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggSegmentedControlModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
955
+ NggSegmentedControlModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggSegmentedControlModule, declarations: [NggSegmentedControlComponent], imports: [RouterModule, CommonModule], exports: [NggSegmentedControlComponent] });
956
+ NggSegmentedControlModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggSegmentedControlModule, imports: [[RouterModule, CommonModule]] });
957
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggSegmentedControlModule, decorators: [{
958
+ type: NgModule,
959
+ args: [{
960
+ declarations: [NggSegmentedControlComponent],
961
+ imports: [RouterModule, CommonModule],
962
+ exports: [NggSegmentedControlComponent],
963
+ }]
964
+ }] });
965
+
966
+ class NggButtonComponent {
967
+ get classes() {
968
+ return [this.variant, this.size ? this.size : false].filter(Boolean).join(" ");
969
+ }
970
+ }
971
+ NggButtonComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
972
+ 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 });
973
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggButtonComponent, decorators: [{
974
+ type: Component,
975
+ args: [{
976
+ // eslint-disable-next-line @angular-eslint/component-selector
977
+ selector: '[ngg-button]',
978
+ template: `<ng-content></ng-content>`,
979
+ changeDetection: ChangeDetectionStrategy.OnPush
980
+ }]
981
+ }], propDecorators: { variant: [{
982
+ type: Input
983
+ }], size: [{
984
+ type: Input
985
+ }], classes: [{
986
+ type: HostBinding,
987
+ args: ['class']
988
+ }] } });
989
+
990
+ class NggButtonModule {
991
+ }
992
+ NggButtonModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggButtonModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
993
+ NggButtonModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggButtonModule, declarations: [NggButtonComponent], imports: [CommonModule], exports: [NggButtonComponent] });
994
+ NggButtonModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggButtonModule, imports: [[CommonModule]] });
995
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggButtonModule, decorators: [{
996
+ type: NgModule,
997
+ args: [{
998
+ declarations: [NggButtonComponent],
999
+ imports: [CommonModule],
1000
+ exports: [NggButtonComponent],
1001
+ }]
1002
+ }] });
1003
+
491
1004
  class NggModule {
492
1005
  }
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: [{
1006
+ NggModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1007
+ NggModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggModule, imports: [CommonModule], exports: [NggAccordionModule,
1008
+ NggBadgeModule,
1009
+ NggButtonModule,
1010
+ NggDatepickerModule,
1011
+ NggDropdownModule,
1012
+ NggModalModule,
1013
+ NggProgressCircleModule,
1014
+ NggSegmentedControlModule] });
1015
+ NggModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggModule, imports: [[CommonModule], NggAccordionModule,
1016
+ NggBadgeModule,
1017
+ NggButtonModule,
1018
+ NggDatepickerModule,
1019
+ NggDropdownModule,
1020
+ NggModalModule,
1021
+ NggProgressCircleModule,
1022
+ NggSegmentedControlModule] });
1023
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggModule, decorators: [{
497
1024
  type: NgModule,
498
1025
  args: [{
499
1026
  declarations: [],
500
1027
  imports: [CommonModule],
501
- exports: [NggSegmentedControlModule, NggDropdownModule, NggDatepickerModule],
1028
+ exports: [
1029
+ NggAccordionModule,
1030
+ NggBadgeModule,
1031
+ NggButtonModule,
1032
+ NggDatepickerModule,
1033
+ NggDropdownModule,
1034
+ NggModalModule,
1035
+ NggProgressCircleModule,
1036
+ NggSegmentedControlModule,
1037
+ ],
502
1038
  }]
503
1039
  }] });
504
1040
 
@@ -506,5 +1042,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.2", ngImpor
506
1042
  * Generated bundle index. Do not edit.
507
1043
  */
508
1044
 
509
- export { NggDatepickerComponent, NggDatepickerModule, NggDropdownComponent, NggDropdownModule, NggModule, NggSegmentedControlComponent, NggSegmentedControlModule };
1045
+ 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
1046
  //# sourceMappingURL=sebgroup-green-angular.mjs.map