@sebgroup/green-angular 1.0.0-beta.3 → 1.0.0-beta.34

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 (39) hide show
  1. package/esm2020/index.mjs +7 -5
  2. package/esm2020/lib/badge/badge.component.mjs +78 -0
  3. package/esm2020/lib/badge/badge.module.mjs +18 -0
  4. package/esm2020/lib/datepicker/datepicker.component.mjs +186 -0
  5. package/esm2020/lib/datepicker/datepicker.module.mjs +19 -0
  6. package/esm2020/lib/dropdown/dropdown-option.directive.mjs +16 -0
  7. package/esm2020/lib/dropdown/dropdown.component.mjs +136 -80
  8. package/esm2020/lib/dropdown/dropdown.module.mjs +8 -31
  9. package/esm2020/lib/green-angular.module.mjs +7 -6
  10. package/esm2020/lib/modal/index.mjs +3 -0
  11. package/esm2020/lib/modal/modal.component.mjs +152 -0
  12. package/esm2020/lib/modal/modal.module.mjs +30 -0
  13. package/esm2020/lib/segmented-control/segmented-control.component.mjs +3 -3
  14. package/esm2020/lib/segmented-control/segmented-control.module.mjs +4 -4
  15. package/fesm2015/sebgroup-green-angular.mjs +605 -479
  16. package/fesm2015/sebgroup-green-angular.mjs.map +1 -1
  17. package/fesm2020/sebgroup-green-angular.mjs +595 -468
  18. package/fesm2020/sebgroup-green-angular.mjs.map +1 -1
  19. package/index.d.ts +6 -4
  20. package/lib/badge/badge.component.d.ts +25 -0
  21. package/lib/badge/badge.module.d.ts +8 -0
  22. package/lib/datepicker/datepicker.component.d.ts +49 -0
  23. package/lib/datepicker/datepicker.module.d.ts +9 -0
  24. package/lib/dropdown/dropdown-option.directive.d.ts +8 -0
  25. package/lib/dropdown/dropdown.component.d.ts +51 -15
  26. package/lib/dropdown/dropdown.module.d.ts +4 -7
  27. package/lib/green-angular.module.d.ts +2 -1
  28. package/lib/modal/index.d.ts +2 -0
  29. package/lib/modal/modal.component.d.ts +50 -0
  30. package/lib/modal/modal.module.d.ts +8 -0
  31. package/package.json +10 -11
  32. package/esm2020/lib/dropdown/popover-element.directive.mjs +0 -218
  33. package/esm2020/lib/dropdown/popover-option.directive.mjs +0 -58
  34. package/esm2020/lib/dropdown/popover-trigger.directive.mjs +0 -80
  35. package/esm2020/lib/dropdown/popover.directive.mjs +0 -46
  36. package/lib/dropdown/popover-element.directive.d.ts +0 -36
  37. package/lib/dropdown/popover-option.directive.d.ts +0 -20
  38. package/lib/dropdown/popover-trigger.directive.d.ts +0 -19
  39. package/lib/dropdown/popover.directive.d.ts +0 -24
@@ -1,19 +1,18 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Component, ChangeDetectionStrategy, Input, NgModule, Directive, forwardRef, Inject, HostBinding, HostListener, EventEmitter, Output, ContentChildren } from '@angular/core';
2
+ import { Component, ChangeDetectionStrategy, Input, NgModule, Directive, EventEmitter, Output, ViewChild, ContentChild, HostBinding } from '@angular/core';
3
3
  import * as i1 from '@angular/common';
4
4
  import { CommonModule } from '@angular/common';
5
5
  import * as i2 from '@angular/router';
6
6
  import { RouterModule } from '@angular/router';
7
7
  import { NG_VALUE_ACCESSOR } from '@angular/forms';
8
- import { BehaviorSubject, Subject, merge, fromEvent, EMPTY } from 'rxjs';
9
- import { tap, takeUntil, skip, switchMap, filter } from 'rxjs/operators';
10
- import { createPopper } from '@popperjs/core';
11
- import { enableBodyScroll, disableBodyScroll } from 'body-scroll-lock';
8
+ import { dropdownValues, createDropdown, randomId, months, years, createDatepicker } from '@sebgroup/extract';
9
+ import { startOfDay, endOfDay } from 'date-fns';
10
+ import { disableBodyScroll, enableBodyScroll } from 'body-scroll-lock';
12
11
 
13
12
  class NggSegmentedControlComponent {
14
13
  }
15
- NggSegmentedControlComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: NggSegmentedControlComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
16
- NggSegmentedControlComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.2", type: NggSegmentedControlComponent, selector: "ngg-segmented-control", inputs: { $controls: "$controls" }, ngImport: i0, template: `
14
+ NggSegmentedControlComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggSegmentedControlComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
15
+ NggSegmentedControlComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.3", type: NggSegmentedControlComponent, selector: "ngg-segmented-control", inputs: { $controls: "$controls" }, ngImport: i0, template: `
17
16
  <div class="group">
18
17
  <a
19
18
  *ngFor="let control of $controls | async"
@@ -24,7 +23,7 @@ NggSegmentedControlComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12
24
23
  >
25
24
  </div>
26
25
  `, 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 });
27
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: NggSegmentedControlComponent, decorators: [{
26
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggSegmentedControlComponent, decorators: [{
28
27
  type: Component,
29
28
  args: [{
30
29
  selector: 'ngg-segmented-control',
@@ -48,10 +47,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImpor
48
47
 
49
48
  class NggSegmentedControlModule {
50
49
  }
51
- NggSegmentedControlModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: NggSegmentedControlModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
52
- NggSegmentedControlModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: NggSegmentedControlModule, declarations: [NggSegmentedControlComponent], imports: [RouterModule, CommonModule], exports: [NggSegmentedControlComponent] });
53
- NggSegmentedControlModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: NggSegmentedControlModule, imports: [[RouterModule, CommonModule]] });
54
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: NggSegmentedControlModule, decorators: [{
50
+ NggSegmentedControlModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggSegmentedControlModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
51
+ NggSegmentedControlModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggSegmentedControlModule, declarations: [NggSegmentedControlComponent], imports: [RouterModule, CommonModule], exports: [NggSegmentedControlComponent] });
52
+ NggSegmentedControlModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggSegmentedControlModule, imports: [[RouterModule, CommonModule]] });
53
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggSegmentedControlModule, decorators: [{
55
54
  type: NgModule,
56
55
  args: [{
57
56
  declarations: [NggSegmentedControlComponent],
@@ -60,534 +59,662 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImpor
60
59
  }]
61
60
  }] });
62
61
 
63
- class NggPopoverDirective {
64
- constructor() {
65
- this._config = {
66
- usePopper: true,
67
- container: '',
68
- useBodyScrollLock: true,
69
- };
70
- this.state = {
71
- $isOpen: new BehaviorSubject(false),
72
- };
73
- }
74
- get config() {
75
- return this._config;
76
- }
77
- set config(config) {
78
- this._config = { ...this.config, ...config };
79
- }
80
- close() {
81
- this.state.$isOpen.next(false);
82
- }
83
- open() {
84
- this.state.$isOpen.next(true);
85
- }
86
- toggle() {
87
- if (this.state.$isOpen.value) {
88
- this.close();
89
- }
90
- else {
91
- this.open();
92
- }
62
+ class NggDropdownOptionDirective {
63
+ constructor(templateRef) {
64
+ this.templateRef = templateRef;
93
65
  }
94
66
  }
95
- NggPopoverDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: NggPopoverDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
96
- NggPopoverDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.0.2", type: NggPopoverDirective, selector: "[nggPopover]", inputs: { config: "config" }, ngImport: i0 });
97
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: NggPopoverDirective, decorators: [{
67
+ NggDropdownOptionDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggDropdownOptionDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
68
+ NggDropdownOptionDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.3", type: NggDropdownOptionDirective, selector: "[nggDropdownOption]", ngImport: i0 });
69
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggDropdownOptionDirective, decorators: [{
98
70
  type: Directive,
99
71
  args: [{
100
- selector: '[nggPopover]',
72
+ selector: '[nggDropdownOption]',
101
73
  }]
102
- }], propDecorators: { config: [{
103
- type: Input
104
- }] } });
74
+ }], ctorParameters: function () { return [{ type: i0.TemplateRef }]; } });
105
75
 
106
- class NggPopoverTriggerDirective {
107
- constructor(popover, _elRef) {
108
- this.popover = popover;
109
- this._elRef = _elRef;
110
- this.$unsubscribe = new Subject();
111
- this.class = 'dropdown-toggle';
112
- this.haspopup = 'listbox';
113
- this.owns = null;
114
- this.expanded = this.popover.state.$isOpen.value;
115
- this.toggle = (event) => {
116
- if ('key' in event && event.key === 'ArrowDown') {
117
- // open popover on arrow down by not stopping event propagation
118
- if (this.popover.state.$isOpen.value) {
119
- return;
120
- }
121
- else {
122
- // prevent container from scrolling
123
- event.preventDefault();
124
- }
125
- }
126
- event.stopPropagation();
127
- this.popover.toggle();
76
+ class NggDropdownComponent {
77
+ constructor(cd) {
78
+ this.cd = cd;
79
+ this.loop = false;
80
+ this.options = [];
81
+ this._multiSelect = false;
82
+ this._searchable = false;
83
+ this.valueChange = new EventEmitter();
84
+ this.touched = new EventEmitter();
85
+ this.toggler = dropdownValues.elements?.toggler;
86
+ this.listbox = dropdownValues.elements?.listbox;
87
+ this.fieldset = dropdownValues.elements?.fieldset;
88
+ this.trackByKey = (index, option) => {
89
+ return option.attributes.id ?? '';
128
90
  };
129
91
  }
130
- ngOnInit() {
131
- // if trigger element does not have an id...
132
- if (!this._elRef.nativeElement.id) {
133
- // ...add a unique id
134
- this._elRef.nativeElement.id = `ngg_dropdownTrigger_${new Date().getTime()}`;
135
- this.owns = this._elRef.nativeElement.id.replace(/dropdownTrigger/, 'popover');
136
- }
137
- else {
138
- this.owns = this._elRef.nativeElement.id + '_popover';
92
+ set multiSelect(value) {
93
+ this._multiSelect = this.convertToBoolean(value);
94
+ }
95
+ get multiSelect() {
96
+ return this._multiSelect;
97
+ }
98
+ set searchable(value) {
99
+ this._searchable = this.convertToBoolean(value);
100
+ }
101
+ get searchable() {
102
+ return this._searchable;
103
+ }
104
+ set value(newValue) {
105
+ this.handler?.selectByValue(newValue);
106
+ this._value = newValue;
107
+ }
108
+ get value() {
109
+ return this._value;
110
+ }
111
+ ngAfterViewInit() {
112
+ if (this.togglerRef?.nativeElement && this.listboxRef?.nativeElement) {
113
+ this.handler = createDropdown(this.props, this.togglerRef.nativeElement, this.listboxRef.nativeElement, this.fieldsetRef?.nativeElement, (dropdown) => {
114
+ this.dropdown = dropdown;
115
+ this.toggler = dropdown.elements.toggler;
116
+ this.listbox = dropdown.elements.listbox;
117
+ this.fieldset = dropdown.elements.fieldset;
118
+ this.cd.detectChanges();
119
+ }, (value) => {
120
+ this.updateValue(value);
121
+ });
139
122
  }
140
- this.popover.triggerElement = this._elRef;
141
- this.popover.state.$isOpen
142
- .pipe(tap((isOpen) => (this.expanded = isOpen)), takeUntil(this.$unsubscribe))
143
- .subscribe();
144
123
  }
145
124
  ngOnDestroy() {
146
- this.$unsubscribe.next();
147
- this.$unsubscribe.complete();
125
+ this.handler?.destroy();
148
126
  }
149
- }
150
- NggPopoverTriggerDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: NggPopoverTriggerDirective, deps: [{ token: forwardRef(() => NggPopoverDirective) }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
151
- NggPopoverTriggerDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.0.2", type: NggPopoverTriggerDirective, selector: "[nggPopoverTrigger]", host: { listeners: { "keydown.arrowdown": "toggle($event)", "click": "toggle($event)" }, properties: { "class": "this.class", "attr.aria-haspopup": "this.haspopup", "attr.aria-owns": "this.owns", "attr.aria-expanded": "this.expanded" } }, ngImport: i0 });
152
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: NggPopoverTriggerDirective, decorators: [{
153
- type: Directive,
154
- args: [{
155
- selector: '[nggPopoverTrigger]',
156
- }]
157
- }], ctorParameters: function () { return [{ type: NggPopoverDirective, decorators: [{
158
- type: Inject,
159
- args: [forwardRef(() => NggPopoverDirective)]
160
- }] }, { type: i0.ElementRef }]; }, propDecorators: { class: [{
161
- type: HostBinding,
162
- args: ['class']
163
- }], haspopup: [{
164
- type: HostBinding,
165
- args: ['attr.aria-haspopup']
166
- }], owns: [{
167
- type: HostBinding,
168
- args: ['attr.aria-owns']
169
- }], expanded: [{
170
- type: HostBinding,
171
- args: ['attr.aria-expanded']
172
- }], toggle: [{
173
- type: HostListener,
174
- args: ['keydown.arrowdown', ['$event']]
175
- }, {
176
- type: HostListener,
177
- args: ['click', ['$event']]
178
- }] } });
179
-
180
- class NggPopoverOptionDirective {
181
- constructor(popover, elRef) {
182
- this.popover = popover;
183
- this.elRef = elRef;
184
- this.selected = false;
185
- this.selectedChanged = new EventEmitter();
186
- this.role = 'option';
187
- this.id = '';
188
- this.clickHandler = (event) => {
189
- this.select(event);
190
- };
191
- this.select = (event) => {
192
- this.selectedChanged.emit(this.nggPopoverOption);
127
+ ngOnChanges(changes) {
128
+ if (this.handler &&
129
+ (changes.id || changes.text || changes.loop || changes.options)) {
130
+ this.handler.update(this.props);
131
+ }
132
+ }
133
+ writeValue(value) {
134
+ this.value = value;
135
+ }
136
+ registerOnChange(fn) {
137
+ this.onChangeFn = fn;
138
+ }
139
+ registerOnTouched(fn) {
140
+ this.onTouchedFn = fn;
141
+ }
142
+ search($event) {
143
+ this.handler?.search($event.target.value);
144
+ }
145
+ get props() {
146
+ return {
147
+ id: this.id || this.dropdown?.id,
148
+ texts: this.texts,
149
+ useValue: this.useValue,
150
+ display: this.display,
151
+ options: this.options,
152
+ loop: this.loop,
153
+ value: this.value,
154
+ multiSelect: this.multiSelect,
155
+ searchable: this.searchable,
156
+ searchFilter: this.searchFilter,
157
+ compareWith: this.compareWith,
158
+ onTouched: () => {
159
+ this.onTouchedFn?.();
160
+ this.touched.emit(true);
161
+ this.cd.markForCheck();
162
+ },
193
163
  };
194
164
  }
195
- get ariaSelected() {
196
- return this.selected || null;
165
+ updateValue(option) {
166
+ this._value = option;
167
+ this.valueChange.emit(option);
168
+ this.onChangeFn?.(option);
197
169
  }
198
- ngOnInit() {
199
- this.id = `${this.popover.triggerElement?.nativeElement.id}_dropdownOption_${this.index}`;
170
+ convertToBoolean(value) {
171
+ return (value === '' || value === 'true' || value.toString() === 'true' || false);
200
172
  }
201
173
  }
202
- NggPopoverOptionDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: NggPopoverOptionDirective, deps: [{ token: forwardRef(() => NggPopoverDirective) }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
203
- NggPopoverOptionDirectivedir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.0.2", type: NggPopoverOptionDirective, selector: "[nggPopoverOption]", inputs: { nggPopoverOption: "nggPopoverOption", index: "index", selected: "selected" }, outputs: { selectedChanged: "selectedChanged" }, host: { listeners: { "click": "clickHandler()" }, properties: { "attr.role": "this.role", "attr.aria-selected": "this.ariaSelected", "attr.id": "this.id" } }, ngImport: i0 });
204
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: NggPopoverOptionDirective, decorators: [{
205
- type: Directive,
206
- args: [{
207
- selector: '[nggPopoverOption]',
208
- }]
209
- }], ctorParameters: function () { return [{ type: NggPopoverDirective, decorators: [{
210
- type: Inject,
211
- args: [forwardRef(() => NggPopoverDirective)]
212
- }] }, { type: i0.ElementRef }]; }, propDecorators: { nggPopoverOption: [{
174
+ NggDropdownComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggDropdownComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
175
+ NggDropdownComponentcmp = 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: [
176
+ {
177
+ provide: NG_VALUE_ACCESSOR,
178
+ useExisting: NggDropdownComponent,
179
+ multi: true,
180
+ },
181
+ ], 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 </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 <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 <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 </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 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: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
182
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggDropdownComponent, decorators: [{
183
+ type: Component,
184
+ args: [{ selector: 'ngg-dropdown', providers: [
185
+ {
186
+ provide: NG_VALUE_ACCESSOR,
187
+ useExisting: NggDropdownComponent,
188
+ multi: true,
189
+ },
190
+ ], 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 </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 <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 <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 </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 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" }]
191
+ }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { id: [{
192
+ type: Input
193
+ }], texts: [{
194
+ type: Input
195
+ }], loop: [{
213
196
  type: Input
214
- }], index: [{
197
+ }], display: [{
215
198
  type: Input
216
- }], selected: [{
199
+ }], useValue: [{
217
200
  type: Input
218
- }], selectedChanged: [{
201
+ }], label: [{
202
+ type: Input
203
+ }], options: [{
204
+ type: Input
205
+ }], valid: [{
206
+ type: Input
207
+ }], invalid: [{
208
+ type: Input
209
+ }], compareWith: [{
210
+ type: Input
211
+ }], searchFilter: [{
212
+ type: Input
213
+ }], multiSelect: [{
214
+ type: Input
215
+ }], searchable: [{
216
+ type: Input
217
+ }], value: [{
218
+ type: Input
219
+ }], valueChange: [{
219
220
  type: Output
220
- }], role: [{
221
- type: HostBinding,
222
- args: ['attr.role']
223
- }], ariaSelected: [{
224
- type: HostBinding,
225
- args: ['attr.aria-selected']
226
- }], id: [{
227
- type: HostBinding,
228
- args: ['attr.id']
229
- }], clickHandler: [{
230
- type: HostListener,
231
- args: ['click']
221
+ }], touched: [{
222
+ type: Output
223
+ }], togglerRef: [{
224
+ type: ViewChild,
225
+ args: ['togglerRef']
226
+ }], listboxRef: [{
227
+ type: ViewChild,
228
+ args: ['listboxRef']
229
+ }], fieldsetRef: [{
230
+ type: ViewChild,
231
+ args: ['fieldsetRef']
232
+ }], customOption: [{
233
+ type: ContentChild,
234
+ args: [NggDropdownOptionDirective]
232
235
  }] } });
233
236
 
234
- class NggPopoverElementDirective {
235
- constructor(popover, _elRef, _renderer, _cdr) {
236
- this.popover = popover;
237
- this._elRef = _elRef;
238
- this._renderer = _renderer;
237
+ class NggDropdownModule {
238
+ }
239
+ NggDropdownModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggDropdownModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
240
+ NggDropdownModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggDropdownModule, declarations: [NggDropdownComponent, NggDropdownOptionDirective], imports: [CommonModule], exports: [NggDropdownComponent, NggDropdownOptionDirective] });
241
+ NggDropdownModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggDropdownModule, imports: [[CommonModule]] });
242
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggDropdownModule, decorators: [{
243
+ type: NgModule,
244
+ args: [{
245
+ declarations: [NggDropdownComponent, NggDropdownOptionDirective],
246
+ imports: [CommonModule],
247
+ exports: [NggDropdownComponent, NggDropdownOptionDirective],
248
+ }]
249
+ }] });
250
+
251
+ class NggDatepickerComponent {
252
+ constructor(_cdr) {
239
253
  this._cdr = _cdr;
240
- this.$unsubscribe = new Subject();
241
- this.sm = window.innerWidth <= 576;
242
- this.class = true;
243
- this.role = 'listbox';
244
- this.id = null;
245
- this.show = this.popover.state.$isOpen.value;
246
- this.activeDescendant = null;
247
- }
248
- // TODO: refactor and move to general size/device service
249
- onResize(event) {
250
- // determine if small screen size i.e less than or equal to 576 pixels which is the breakpoint for small screens
251
- this.sm = event.target.innerWidth <= 576;
252
- if (this.sm) {
253
- // remove popper
254
- this.removePopper();
255
- }
256
- else if (!this._popper) {
257
- // add popper
258
- this.addPopper();
259
- }
254
+ this.id = randomId();
255
+ this.isValid = null;
256
+ this.valueChange = new EventEmitter();
257
+ this._months = months({});
258
+ this.listener = (data, state) => {
259
+ if (this.dp && state) {
260
+ this.dp.state = { ...state };
261
+ this.years = years({
262
+ from: this.dp.state?.minDate?.getFullYear(),
263
+ to: this.dp.state?.maxDate?.getFullYear(),
264
+ });
265
+ }
266
+ this.onTouchedFn && this.onTouchedFn();
267
+ if (data) {
268
+ // only emit change event if date has changed
269
+ if (this.data?.selectedDate !== data.selectedDate) {
270
+ this.valueChange.emit(data.selectedDate);
271
+ this.onChangeFn && this.onChangeFn(data.selectedDate);
272
+ }
273
+ this.data = data;
274
+ }
275
+ if (data || state) {
276
+ this._cdr.markForCheck();
277
+ }
278
+ };
260
279
  }
261
- handleClickEvent(event) {
262
- // if click inside popover element...
263
- if (this._elRef.nativeElement.contains(event.target)) {
264
- this.popover.close();
265
- }
266
- else if (this.popover.state.$isOpen.value) {
267
- // else if click outside popover element...
268
- this.popover.close();
269
- }
280
+ get months() {
281
+ return this._months;
270
282
  }
271
- handleKeydownEvent(event) {
272
- if (event.key === 'Escape') {
273
- this.popover.close();
274
- return;
275
- }
276
- let next = 0; // Used for home key
277
- const currentSelection = this.options?.find((option) => !!option.selected)?.index || 0;
278
- if (event.key === 'End') {
279
- // set next to last option
280
- next = (this.options?.length || 1) - 1;
281
- }
282
- else if (event.key === 'ArrowUp') {
283
- // next can't be less than zero
284
- next = Math.max(0, currentSelection - 1);
285
- // prevent container from scrolling
286
- event.preventDefault();
287
- }
288
- else if (event.key === 'ArrowDown') {
289
- // next can't be greater than number of options
290
- next = Math.min((this.options?.length || 1) - 1, currentSelection + 1);
291
- // prevent container from scrolling
292
- event.preventDefault();
283
+ set months(value) {
284
+ this._months = value;
285
+ }
286
+ get options() {
287
+ return this._options;
288
+ }
289
+ set options(value) {
290
+ this._options = value;
291
+ if (value.locale) {
292
+ this.months = months({ locale: this.options?.locale });
293
293
  }
294
- // select next option
295
- this.options?.get(next)?.select(event);
296
294
  }
297
- ngOnInit() {
298
- this.id = /^ngg_dropdownTrigger/.test(this.popover.triggerElement?.nativeElement.id)
299
- ? this.popover.triggerElement?.nativeElement.id.replace(/dropdownTrigger/, 'popover')
300
- : this.popover.triggerElement?.nativeElement.id + '_popover';
301
- this.popover.state.$isOpen
302
- .pipe(skip(1), // skip initial value
303
- tap((isOpen) => {
304
- this.show = isOpen; // toggle visibility
305
- if (isOpen) {
306
- this.activeDescendant =
307
- this.options?.find((option) => !!option.selected)?.id || null;
308
- // if use body scroll lock
309
- if (this.popover.config.useBodyScrollLock) {
310
- this.disableBodyScrollLock();
311
- }
312
- // if popover is configured to use a container...
313
- if (this.popover.config.container !== '') {
314
- // ...add container
315
- this.addContainer();
316
- }
317
- // if popover is configured to use popper.js...
318
- if (this.popover.config.usePopper) {
319
- this.addPopper();
320
- }
321
- }
322
- else {
323
- this.activeDescendant = null;
324
- if (this.popover.config.useBodyScrollLock) {
325
- this.enableBodyScrollLock();
326
- }
327
- this.removeContainer();
328
- this.removePopper();
329
- }
330
- }), switchMap((isOpen) => isOpen
331
- ? merge(
332
- // listen to click events
333
- fromEvent(document, 'click').pipe(tap((event) => this.handleClickEvent(event))),
334
- // listen to keydown events
335
- fromEvent(document, 'keydown').pipe(
336
- // filter keys
337
- filter((event) => ['ArrowDown', 'ArrowUp', 'Escape', 'Home', 'End'].indexOf(event.key) !== -1), tap((event) => this.handleKeydownEvent(event))))
338
- : EMPTY), takeUntil(this.$unsubscribe))
339
- .subscribe();
295
+ get value() {
296
+ return this._value;
340
297
  }
341
- ngOnDestroy() {
342
- this.removePopper();
343
- // enable scroll if body scroll lock is used
344
- if (this.popover.config.useBodyScrollLock) {
345
- this.enableBodyScrollLock();
298
+ set value(newValue) {
299
+ if (newValue !== this._value) {
300
+ this._value = newValue;
346
301
  }
347
- // remove container if declared
348
- if (this._container) {
349
- this.removeContainer();
302
+ }
303
+ writeValue(value) {
304
+ this.value = value;
305
+ // When binding using ngModel we need to set initial select date
306
+ // once we get initial value as it's not available when component is created
307
+ if (value && this.dp && !this.data?.selectedDate) {
308
+ this.dp.select(value);
350
309
  }
351
- this.$unsubscribe.next();
352
- this.$unsubscribe.complete();
353
310
  }
354
- enableBodyScrollLock() {
355
- enableBodyScroll(this._elRef.nativeElement);
311
+ registerOnChange(fn) {
312
+ this.onChangeFn = fn;
313
+ }
314
+ registerOnTouched(fn) {
315
+ this.onTouchedFn = fn;
356
316
  }
357
- disableBodyScrollLock() {
358
- disableBodyScroll(this._elRef.nativeElement);
317
+ get data() {
318
+ return this._data;
359
319
  }
360
- addPopper() {
361
- if (this.sm) {
362
- return;
320
+ set data(value) {
321
+ this._data = value;
322
+ }
323
+ onDateChange(value) {
324
+ const newDate = new Date(value);
325
+ // Only pass valid date to date picker
326
+ if (!isNaN(newDate.getTime())) {
327
+ this.dp?.select(value);
363
328
  }
364
- if (!this._popper) {
365
- // ...create popper instance for anchoring popover with trigger element
366
- this._popper = createPopper(this.popover.triggerElement?.nativeElement, this._elRef.nativeElement, {
367
- placement: 'bottom-start',
368
- modifiers: [
369
- {
370
- name: 'offset',
371
- options: {
372
- offset: [0, 4],
373
- },
374
- },
375
- ],
376
- });
377
- // detect changes once element and popper is initiated to update initial position
329
+ else {
330
+ this.valueChange.emit(value);
331
+ this.onChangeFn && this.onChangeFn(value);
332
+ }
333
+ }
334
+ trackWeek(index, week) {
335
+ return week;
336
+ }
337
+ ngAfterViewInit() {
338
+ // initialize datepicker
339
+ if (this.datepickerElRef &&
340
+ this.datepickerDialogElRef &&
341
+ this.dateInputElRef &&
342
+ this.datepickerTriggerElRef &&
343
+ !this.dp) {
344
+ this.dp = createDatepicker(this.listener, {
345
+ ...this.options,
346
+ selectedDate: this.value,
347
+ }, this.datepickerElRef.nativeElement, this.datepickerDialogElRef.nativeElement, this.dateInputElRef.nativeElement, this.datepickerTriggerElRef.nativeElement);
378
348
  this._cdr.detectChanges();
379
349
  }
380
350
  else {
381
- this._popper.state.elements.reference =
382
- this.popover.triggerElement?.nativeElement;
383
- this._popper.update().then((_) => this._cdr.detectChanges());
351
+ throw 'Missing one or more elements...';
384
352
  }
385
353
  }
386
- removePopper() {
387
- // destroy popper if declared
388
- if (this._popper) {
389
- this._popper?.destroy();
390
- this._popper = null;
354
+ }
355
+ NggDatepickerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggDatepickerComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
356
+ 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: [
357
+ {
358
+ provide: NG_VALUE_ACCESSOR,
359
+ useExisting: NggDatepickerComponent,
360
+ multi: true,
361
+ },
362
+ ], 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()\">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: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
363
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggDatepickerComponent, decorators: [{
364
+ type: Component,
365
+ args: [{ selector: 'ngg-datepicker', providers: [
366
+ {
367
+ provide: NG_VALUE_ACCESSOR,
368
+ useExisting: NggDatepickerComponent,
369
+ multi: true,
370
+ },
371
+ ], 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()\">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" }]
372
+ }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { options: [{
373
+ type: Input
374
+ }], value: [{
375
+ type: Input
376
+ }], id: [{
377
+ type: Input
378
+ }], label: [{
379
+ type: Input
380
+ }], isValid: [{
381
+ type: Input
382
+ }], valueChange: [{
383
+ type: Output
384
+ }], datepickerDialogElRef: [{
385
+ type: ViewChild,
386
+ args: ['datepickerDialogElRef']
387
+ }], dateInputElRef: [{
388
+ type: ViewChild,
389
+ args: ['dateInputElRef']
390
+ }], datepickerElRef: [{
391
+ type: ViewChild,
392
+ args: ['datepickerElRef']
393
+ }], datepickerTriggerElRef: [{
394
+ type: ViewChild,
395
+ args: ['datepickerTriggerElRef']
396
+ }] } });
397
+ function dateValidator(dates) {
398
+ return (control) => {
399
+ const value = control.value;
400
+ if (!value) {
401
+ return null;
391
402
  }
392
- }
393
- addContainer() {
394
- // create global container for popover if not already present
395
- if (!this._container) {
396
- this._container = this._renderer.createElement('div');
403
+ const newDate = new Date(value);
404
+ const isValidDate = !isNaN(newDate.getTime());
405
+ if (!isValidDate) {
406
+ return { validDate: true };
397
407
  }
398
- this._renderer.appendChild(this._container, this._elRef.nativeElement);
399
- this._renderer.appendChild(document.body, this._container);
400
- }
401
- removeContainer() {
402
- if (this._container) {
403
- // remove container from DOM tree
404
- this._renderer.removeChild(document.body, this._container);
405
- // clear container
406
- this._container = null;
408
+ const validMinDate = dates?.min ? newDate >= startOfDay(dates.min) : true;
409
+ const validMaxDate = dates?.max ? newDate <= endOfDay(dates.max) : true;
410
+ if (!validMinDate && dates?.min) {
411
+ return {
412
+ validDate: {
413
+ minDate: startOfDay(dates.min),
414
+ actualDate: newDate,
415
+ },
416
+ };
407
417
  }
408
- }
418
+ if (!validMaxDate && dates?.max) {
419
+ return {
420
+ validDate: {
421
+ maxDate: endOfDay(dates.max),
422
+ actualDate: newDate,
423
+ },
424
+ };
425
+ }
426
+ return null;
427
+ };
409
428
  }
410
- NggPopoverElementDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: NggPopoverElementDirective, deps: [{ token: forwardRef(() => NggPopoverDirective) }, { token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Directive });
411
- NggPopoverElementDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.0.2", type: NggPopoverElementDirective, selector: "[nggPopoverElement]", host: { listeners: { "window:resize": "onResize($event)" }, properties: { "class.popover": "this.class", "attr.role": "this.role", "attr.id": "this.id", "class.active": "this.show", "attr.aria-activedescendant": "this.activeDescendant" } }, queries: [{ propertyName: "options", predicate: NggPopoverOptionDirective, descendants: true }], ngImport: i0 });
412
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: NggPopoverElementDirective, decorators: [{
413
- type: Directive,
429
+
430
+ class NggDatepickerModule {
431
+ }
432
+ NggDatepickerModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggDatepickerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
433
+ NggDatepickerModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggDatepickerModule, declarations: [NggDatepickerComponent], imports: [CommonModule, NggDropdownModule], exports: [NggDatepickerComponent] });
434
+ NggDatepickerModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggDatepickerModule, imports: [[CommonModule, NggDropdownModule]] });
435
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggDatepickerModule, decorators: [{
436
+ type: NgModule,
414
437
  args: [{
415
- selector: '[nggPopoverElement]',
438
+ declarations: [NggDatepickerComponent],
439
+ imports: [CommonModule, NggDropdownModule],
440
+ exports: [NggDatepickerComponent],
416
441
  }]
417
- }], ctorParameters: function () { return [{ type: NggPopoverDirective, decorators: [{
418
- type: Inject,
419
- args: [forwardRef(() => NggPopoverDirective)]
420
- }] }, { type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { options: [{
421
- type: ContentChildren,
422
- args: [NggPopoverOptionDirective, { descendants: true }]
423
- }], class: [{
424
- type: HostBinding,
425
- args: ['class.popover']
426
- }], role: [{
427
- type: HostBinding,
428
- args: ['attr.role']
429
- }], id: [{
430
- type: HostBinding,
431
- args: ['attr.id']
432
- }], show: [{
433
- type: HostBinding,
434
- args: ['class.active']
435
- }], activeDescendant: [{
436
- type: HostBinding,
437
- args: ['attr.aria-activedescendant']
438
- }], onResize: [{
439
- type: HostListener,
440
- args: ['window:resize', ['$event']]
441
- }] } });
442
+ }] });
442
443
 
443
- class NggDropdownComponent {
444
- constructor() {
445
- this._options = [];
446
- this._config = {};
444
+ class NggModule {
445
+ }
446
+ NggModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
447
+ NggModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggModule, imports: [CommonModule], exports: [NggSegmentedControlModule, NggDropdownModule, NggDatepickerModule] });
448
+ NggModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggModule, imports: [[CommonModule], NggSegmentedControlModule, NggDropdownModule, NggDatepickerModule] });
449
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggModule, decorators: [{
450
+ type: NgModule,
451
+ args: [{
452
+ declarations: [],
453
+ imports: [CommonModule],
454
+ exports: [NggSegmentedControlModule, NggDropdownModule, NggDatepickerModule],
455
+ }]
456
+ }] });
457
+
458
+ class NggModalComponent {
459
+ constructor(ref) {
460
+ this.ref = ref;
461
+ this.isOpenChange = new EventEmitter();
462
+ this.closed = new EventEmitter();
463
+ this.confirm = new EventEmitter();
464
+ this.dismiss = new EventEmitter();
465
+ }
466
+ get isOpen() {
467
+ return this._isOpen;
468
+ }
469
+ set isOpen(value) {
470
+ this._isOpen = value;
471
+ if (value) {
472
+ disableBodyScroll(this.ref.nativeElement);
473
+ }
474
+ else {
475
+ enableBodyScroll(this.ref.nativeElement);
476
+ }
447
477
  }
448
- get options() {
449
- return this._options;
478
+ get open() { return this.isOpen; }
479
+ handleCloseClick(event) {
480
+ this.closeModal(event);
450
481
  }
451
- set options(value) {
452
- this._options = value;
482
+ handleBackdropClick(event) {
483
+ if (event.target == this.backdropRef?.nativeElement)
484
+ this.closeModal(event);
453
485
  }
454
- get config() {
455
- return this._config;
486
+ handleDismiss(event) {
487
+ this.dismiss.emit(event);
456
488
  }
457
- set config(value) {
458
- this._config = value;
489
+ handleConfirm(event) {
490
+ this.confirm.emit(event);
459
491
  }
460
- writeValue(obj) {
461
- this.value = obj;
492
+ closeModal(event) {
493
+ if (this.closed.observers.length > 0) {
494
+ this.closed.emit(event);
495
+ }
496
+ else {
497
+ this.isOpen = false;
498
+ this.isOpenChange.emit(this.isOpen);
499
+ }
462
500
  }
463
- registerOnChange(fn) {
464
- this.onChangeFn = fn;
501
+ ngOnDestroy() {
502
+ enableBodyScroll(this.ref.nativeElement);
465
503
  }
466
- registerOnTouched(fn) {
467
- this.onTouchedFn = fn;
504
+ }
505
+ NggModalComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggModalComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
506
+ 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", 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 i1.NgIf; }), selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i0.forwardRef(function () { return i1.NgSwitch; }), selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i0.forwardRef(function () { return i1.NgSwitchCase; }), selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: i0.forwardRef(function () { return i1.NgTemplateOutlet; }), selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i0.forwardRef(function () { return i1.NgSwitchDefault; }), selector: "[ngSwitchDefault]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
507
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggModalComponent, decorators: [{
508
+ type: Component,
509
+ 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"] }]
510
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { modalType: [{
511
+ type: Input
512
+ }], header: [{
513
+ type: Input
514
+ }], confirmLabel: [{
515
+ type: Input
516
+ }], dismissLabel: [{
517
+ type: Input
518
+ }], size: [{
519
+ type: Input
520
+ }], isOpen: [{
521
+ type: Input
522
+ }], isOpenChange: [{
523
+ type: Output
524
+ }], closed: [{
525
+ type: Output
526
+ }], confirm: [{
527
+ type: Output
528
+ }], dismiss: [{
529
+ type: Output
530
+ }], open: [{
531
+ type: HostBinding,
532
+ args: ['class.open']
533
+ }], backdropRef: [{
534
+ type: ViewChild,
535
+ args: ['backdrop']
536
+ }] } });
537
+ class NggModalHeaderComponent {
538
+ constructor() {
539
+ this.closed = new EventEmitter();
468
540
  }
469
- select(value) {
470
- this.onChangeFn(value);
471
- this.value = value;
541
+ handleClose(event) {
542
+ this.closed.emit(event);
472
543
  }
473
544
  }
474
- NggDropdownComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: NggDropdownComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
475
- NggDropdownComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.2", type: NggDropdownComponent, selector: "ngg-dropdown", inputs: { options: "options", config: "config" }, providers: [
476
- {
477
- provide: NG_VALUE_ACCESSOR,
478
- useExisting: NggDropdownComponent,
479
- multi: true,
480
- },
481
- ], ngImport: i0, template: `
482
- <div nggPopover [config]="config">
483
- <button type="button" nggPopoverTrigger>
484
- {{ value }}
485
- </button>
486
- <div nggPopoverElement tabindex="-1" autofocus>
487
- <button class="close m-4 m-sm-2 d-block d-sm-none ">
488
- <span class="sr-only">Close</span>
489
- </button>
490
- <ul role="listbox">
491
- <li
492
- *ngFor="let option of options; let i = index"
493
- [nggPopoverOption]="option.value"
494
- [index]="i"
495
- [selected]="value === option.value"
496
- (selectedChanged)="select($event)"
497
- >
498
- {{ option.key }}
499
- </li>
500
- </ul>
501
- </div>
502
- </div>
503
- `, isInline: true, directives: [{ type: NggPopoverDirective, selector: "[nggPopover]", inputs: ["config"] }, { type: NggPopoverTriggerDirective, selector: "[nggPopoverTrigger]" }, { type: NggPopoverElementDirective, selector: "[nggPopoverElement]" }, { type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: NggPopoverOptionDirective, selector: "[nggPopoverOption]", inputs: ["nggPopoverOption", "index", "selected"], outputs: ["selectedChanged"] }] });
504
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: NggDropdownComponent, decorators: [{
545
+ NggModalHeaderComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggModalHeaderComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
546
+ 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: `
547
+ <h3 data-testid="modal-header-text">{{header}}</h3>
548
+ <button data-testid="modal-close-button" class="close" (click)="this.handleClose($event)">
549
+ <span className="sr-only">Close</span>
550
+ </button>
551
+ `, 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"] });
552
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggModalHeaderComponent, decorators: [{
505
553
  type: Component,
506
- args: [{
507
- selector: 'ngg-dropdown',
508
- template: `
509
- <div nggPopover [config]="config">
510
- <button type="button" nggPopoverTrigger>
511
- {{ value }}
512
- </button>
513
- <div nggPopoverElement tabindex="-1" autofocus>
514
- <button class="close m-4 m-sm-2 d-block d-sm-none ">
515
- <span class="sr-only">Close</span>
516
- </button>
517
- <ul role="listbox">
518
- <li
519
- *ngFor="let option of options; let i = index"
520
- [nggPopoverOption]="option.value"
521
- [index]="i"
522
- [selected]="value === option.value"
523
- (selectedChanged)="select($event)"
524
- >
525
- {{ option.key }}
526
- </li>
527
- </ul>
528
- </div>
529
- </div>
530
- `,
531
- providers: [
532
- {
533
- provide: NG_VALUE_ACCESSOR,
534
- useExisting: NggDropdownComponent,
535
- multi: true,
536
- },
537
- ],
538
- //changeDetection: ChangeDetectionStrategy.OnPush
539
- }]
540
- }], propDecorators: { options: [{
554
+ args: [{ selector: '[ngg-modal-header]', template: `
555
+ <h3 data-testid="modal-header-text">{{header}}</h3>
556
+ <button data-testid="modal-close-button" class="close" (click)="this.handleClose($event)">
557
+ <span className="sr-only">Close</span>
558
+ </button>
559
+ `, 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"] }]
560
+ }], propDecorators: { header: [{
541
561
  type: Input
542
- }], config: [{
562
+ }], closed: [{
563
+ type: Output
564
+ }] } });
565
+ class NggModalBodyComponent {
566
+ }
567
+ NggModalBodyComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggModalBodyComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
568
+ 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"] });
569
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggModalBodyComponent, decorators: [{
570
+ type: Component,
571
+ 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"] }]
572
+ }] });
573
+ class NggModalFooterComponent {
574
+ constructor() {
575
+ this.dismiss = new EventEmitter();
576
+ this.confirm = new EventEmitter();
577
+ }
578
+ handleDismiss(event) {
579
+ this.dismiss.emit(event);
580
+ }
581
+ handleConfirm(event) {
582
+ this.confirm.emit(event);
583
+ }
584
+ }
585
+ NggModalFooterComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggModalFooterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
586
+ 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: `
587
+ <button data-testid="modal-dismiss-button" *ngIf="dismissLabel" class="secondary" (click)="this.handleDismiss($event)">{{dismissLabel}}</button>
588
+ <button data-testid="modal-confirm-button" *ngIf="confirmLabel" class="primary" (click)="this.handleConfirm($event)">{{confirmLabel}}</button>
589
+ `, 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: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
590
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggModalFooterComponent, decorators: [{
591
+ type: Component,
592
+ args: [{ selector: '[ngg-modal-footer]', template: `
593
+ <button data-testid="modal-dismiss-button" *ngIf="dismissLabel" class="secondary" (click)="this.handleDismiss($event)">{{dismissLabel}}</button>
594
+ <button data-testid="modal-confirm-button" *ngIf="confirmLabel" class="primary" (click)="this.handleConfirm($event)">{{confirmLabel}}</button>
595
+ `, 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"] }]
596
+ }], propDecorators: { dismissLabel: [{
543
597
  type: Input
598
+ }], confirmLabel: [{
599
+ type: Input
600
+ }], dismiss: [{
601
+ type: Output
602
+ }], confirm: [{
603
+ type: Output
544
604
  }] } });
545
605
 
546
- class NggDropdownModule {
606
+ const DECLARATIONS = [
607
+ NggModalComponent,
608
+ NggModalHeaderComponent,
609
+ NggModalBodyComponent,
610
+ NggModalFooterComponent
611
+ ];
612
+ const EXPORTS = [
613
+ NggModalComponent,
614
+ ];
615
+ class NggModalModule {
547
616
  }
548
- NggDropdownModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: NggDropdownModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
549
- NggDropdownModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: NggDropdownModule, declarations: [NggPopoverDirective,
550
- NggPopoverOptionDirective,
551
- NggPopoverElementDirective,
552
- NggPopoverTriggerDirective,
553
- NggDropdownComponent], imports: [CommonModule], exports: [NggPopoverDirective,
554
- NggPopoverOptionDirective,
555
- NggPopoverElementDirective,
556
- NggPopoverTriggerDirective,
557
- NggDropdownComponent] });
558
- NggDropdownModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: NggDropdownModule, imports: [[CommonModule]] });
559
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: NggDropdownModule, decorators: [{
617
+ NggModalModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggModalModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
618
+ NggModalModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggModalModule, declarations: [NggModalComponent,
619
+ NggModalHeaderComponent,
620
+ NggModalBodyComponent,
621
+ NggModalFooterComponent], imports: [CommonModule], exports: [NggModalComponent] });
622
+ NggModalModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggModalModule, imports: [[CommonModule]] });
623
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggModalModule, decorators: [{
560
624
  type: NgModule,
561
625
  args: [{
562
- declarations: [
563
- NggPopoverDirective,
564
- NggPopoverOptionDirective,
565
- NggPopoverElementDirective,
566
- NggPopoverTriggerDirective,
567
- NggDropdownComponent,
568
- ],
569
626
  imports: [CommonModule],
570
- exports: [
571
- NggPopoverDirective,
572
- NggPopoverOptionDirective,
573
- NggPopoverElementDirective,
574
- NggPopoverTriggerDirective,
575
- NggDropdownComponent,
576
- ],
627
+ exports: EXPORTS,
628
+ declarations: DECLARATIONS,
577
629
  }]
578
630
  }] });
579
631
 
580
- class NggModule {
632
+ class NggBadgeComponent {
633
+ //eslint-disable-next-line
634
+ constructor() {
635
+ /** The color of the component */
636
+ this.badgeType = '';
637
+ /** Callback when component is dismissed */
638
+ this.handleClose = new EventEmitter();
639
+ }
640
+ /** Flag whether the component can be dismissed */
641
+ set isCloseable(value) {
642
+ this._isCloseable = value;
643
+ }
644
+ get isCloseable() {
645
+ return this._isCloseable === '' || !!this._isCloseable;
646
+ }
647
+ get class() {
648
+ return ['badge', this.badgeType].join(' ');
649
+ }
650
+ ngOnInit() {
651
+ if (!!this.customColor || !!this.customBackgroundColor) {
652
+ this.badgeType = '';
653
+ }
654
+ }
655
+ close(e) {
656
+ this.handleClose.emit(e);
657
+ }
581
658
  }
582
- NggModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: NggModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
583
- NggModulemod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: NggModule, imports: [CommonModule], exports: [NggSegmentedControlModule, NggDropdownModule] });
584
- NggModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: NggModule, imports: [[CommonModule], NggSegmentedControlModule, NggDropdownModule] });
585
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: NggModule, decorators: [{
659
+ NggBadgeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggBadgeComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
660
+ NggBadgeComponentcmp = 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: `
661
+ <strong>
662
+ <ng-content></ng-content>
663
+ </strong>
664
+ <button *ngIf="isCloseable" class="close" (click)="close($event)">
665
+ {{ closeText }}
666
+ </button>
667
+ `, isInline: true, directives: [{ type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
668
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggBadgeComponent, decorators: [{
669
+ type: Component,
670
+ args: [{
671
+ // we need to disable this warning since we don't want the badge component to create a new element
672
+ // eslint-disable-next-line @angular-eslint/component-selector
673
+ selector: '[ngg-badge]',
674
+ template: `
675
+ <strong>
676
+ <ng-content></ng-content>
677
+ </strong>
678
+ <button *ngIf="isCloseable" class="close" (click)="close($event)">
679
+ {{ closeText }}
680
+ </button>
681
+ `,
682
+ changeDetection: ChangeDetectionStrategy.OnPush,
683
+ }]
684
+ }], ctorParameters: function () { return []; }, propDecorators: { badgeType: [{
685
+ type: Input
686
+ }], isCloseable: [{
687
+ type: Input
688
+ }], closeText: [{
689
+ type: Input
690
+ }], customColor: [{
691
+ type: HostBinding,
692
+ args: ['style.color']
693
+ }, {
694
+ type: Input
695
+ }], customBackgroundColor: [{
696
+ type: HostBinding,
697
+ args: ['style.background-color']
698
+ }, {
699
+ type: Input
700
+ }], class: [{
701
+ type: HostBinding,
702
+ args: ['class']
703
+ }], handleClose: [{
704
+ type: Output
705
+ }] } });
706
+
707
+ class NggBadgeModule {
708
+ }
709
+ NggBadgeModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggBadgeModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
710
+ NggBadgeModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggBadgeModule, declarations: [NggBadgeComponent], imports: [CommonModule], exports: [NggBadgeComponent] });
711
+ NggBadgeModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggBadgeModule, imports: [[CommonModule]] });
712
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.3", ngImport: i0, type: NggBadgeModule, decorators: [{
586
713
  type: NgModule,
587
714
  args: [{
588
- declarations: [],
715
+ declarations: [NggBadgeComponent],
589
716
  imports: [CommonModule],
590
- exports: [NggSegmentedControlModule, NggDropdownModule],
717
+ exports: [NggBadgeComponent],
591
718
  }]
592
719
  }] });
593
720
 
@@ -595,5 +722,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImpor
595
722
  * Generated bundle index. Do not edit.
596
723
  */
597
724
 
598
- export { NggDropdownComponent, NggDropdownModule, NggModule, NggPopoverDirective, NggPopoverElementDirective, NggPopoverOptionDirective, NggPopoverTriggerDirective, NggSegmentedControlComponent, NggSegmentedControlModule };
725
+ export { NggBadgeComponent, NggBadgeModule, NggDatepickerComponent, NggDatepickerModule, NggDropdownComponent, NggDropdownModule, NggDropdownOptionDirective, NggModalBodyComponent, NggModalComponent, NggModalFooterComponent, NggModalHeaderComponent, NggModalModule, NggModule, NggSegmentedControlComponent, NggSegmentedControlModule, dateValidator };
599
726
  //# sourceMappingURL=sebgroup-green-angular.mjs.map