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

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