@sebgroup/green-angular 1.0.0-beta.1 → 1.0.0-beta.5

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 (45) hide show
  1. package/esm2020/index.mjs +6 -0
  2. package/esm2020/lib/dropdown/dropdown.component.mjs +196 -0
  3. package/esm2020/lib/dropdown/dropdown.module.mjs +18 -0
  4. package/esm2020/lib/green-angular.module.mjs +19 -0
  5. package/esm2020/lib/segmented-control/segmented-control.component.mjs +40 -0
  6. package/esm2020/lib/segmented-control/segmented-control.module.mjs +19 -0
  7. package/esm2020/sebgroup-green-angular.mjs +5 -0
  8. package/fesm2015/sebgroup-green-angular.mjs +288 -0
  9. package/fesm2015/sebgroup-green-angular.mjs.map +1 -0
  10. package/fesm2020/sebgroup-green-angular.mjs +284 -0
  11. package/fesm2020/sebgroup-green-angular.mjs.map +1 -0
  12. package/index.d.ts +0 -4
  13. package/lib/dropdown/dropdown.component.d.ts +25 -11
  14. package/lib/dropdown/dropdown.module.d.ts +3 -7
  15. package/package.json +31 -15
  16. package/bundles/sebgroup-green-angular.umd.js +0 -610
  17. package/bundles/sebgroup-green-angular.umd.js.map +0 -1
  18. package/esm2015/index.js +0 -10
  19. package/esm2015/index.js.map +0 -1
  20. package/esm2015/lib/dropdown/dropdown.component.js +0 -111
  21. package/esm2015/lib/dropdown/dropdown.component.js.map +0 -1
  22. package/esm2015/lib/dropdown/dropdown.module.js +0 -42
  23. package/esm2015/lib/dropdown/dropdown.module.js.map +0 -1
  24. package/esm2015/lib/dropdown/popover-element.directive.js +0 -220
  25. package/esm2015/lib/dropdown/popover-element.directive.js.map +0 -1
  26. package/esm2015/lib/dropdown/popover-option.directive.js +0 -59
  27. package/esm2015/lib/dropdown/popover-option.directive.js.map +0 -1
  28. package/esm2015/lib/dropdown/popover-trigger.directive.js +0 -80
  29. package/esm2015/lib/dropdown/popover-trigger.directive.js.map +0 -1
  30. package/esm2015/lib/dropdown/popover.directive.js +0 -46
  31. package/esm2015/lib/dropdown/popover.directive.js.map +0 -1
  32. package/esm2015/lib/green-angular.module.js +0 -19
  33. package/esm2015/lib/green-angular.module.js.map +0 -1
  34. package/esm2015/lib/segmented-control/segmented-control.component.js +0 -40
  35. package/esm2015/lib/segmented-control/segmented-control.component.js.map +0 -1
  36. package/esm2015/lib/segmented-control/segmented-control.module.js +0 -19
  37. package/esm2015/lib/segmented-control/segmented-control.module.js.map +0 -1
  38. package/esm2015/sebgroup-green-angular.js +0 -5
  39. package/esm2015/sebgroup-green-angular.js.map +0 -1
  40. package/fesm2015/sebgroup-green-angular.js +0 -602
  41. package/fesm2015/sebgroup-green-angular.js.map +0 -1
  42. package/lib/dropdown/popover-element.directive.d.ts +0 -36
  43. package/lib/dropdown/popover-option.directive.d.ts +0 -20
  44. package/lib/dropdown/popover-trigger.directive.d.ts +0 -19
  45. package/lib/dropdown/popover.directive.d.ts +0 -24
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sebgroup-green-angular.mjs","sources":["../../../../libs/angular/src/lib/segmented-control/segmented-control.component.ts","../../../../libs/angular/src/lib/segmented-control/segmented-control.module.ts","../../../../libs/angular/src/lib/dropdown/dropdown.component.ts","../../../../libs/angular/src/lib/dropdown/dropdown.module.ts","../../../../libs/angular/src/lib/green-angular.module.ts","../../../../libs/angular/src/sebgroup-green-angular.ts"],"sourcesContent":["import { Component, ChangeDetectionStrategy, Input } from '@angular/core'\nimport { Observable } from 'rxjs'\nexport interface SegmentedControl {\n url: string\n text: Observable<string> | string\n}\n@Component({\n selector: 'ngg-segmented-control',\n template: `\n <div class=\"group\">\n <a\n *ngFor=\"let control of $controls | async\"\n [routerLink]=\"control.url\"\n routerLinkActive=\"active\"\n class=\"button\"\n >{{ control.text }}</a\n >\n </div>\n `,\n styles: [],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class NggSegmentedControlComponent {\n @Input() $controls: Observable<Array<SegmentedControl>> | undefined\n}\n","import { NgModule } from '@angular/core'\nimport { CommonModule } from '@angular/common'\nimport { NggSegmentedControlComponent } from './segmented-control.component'\nimport { RouterModule } from '@angular/router'\n\n@NgModule({\n declarations: [NggSegmentedControlComponent],\n imports: [RouterModule, CommonModule],\n exports: [NggSegmentedControlComponent],\n})\nexport class NggSegmentedControlModule {}\n","import {\n AfterViewInit,\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n ElementRef,\n Input,\n OnChanges,\n OnDestroy,\n ViewChild,\n} from '@angular/core'\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'\nimport {\n createDropdown,\n AbstractDropdown,\n DropdownHandler,\n DropdownOption,\n ExtendedDropdownOption,\n ElementProps,\n DropdownArgs,\n} from '@sebgroup/extract'\n\n@Component({\n selector: 'ngg-dropdown',\n template: `\n <div>\n <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 >\n {{ dropdown?.text }}\n </button>\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 class=\"close m-4 m-sm-2 d-block d-sm-none\"\n (click)=\"handler?.close()\"\n >\n <span class=\"sr-only\">Close</span>\n </button>\n <ul role=\"listbox\">\n <li\n *ngFor=\"let option of dropdown?.options; trackBy: trackByKey\"\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)=\"select(option)\"\n >\n {{ option.key }}\n </li>\n </ul>\n </div>\n </div>\n `,\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: NggDropdownComponent,\n multi: true,\n },\n ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class NggDropdownComponent\n implements ControlValueAccessor, AfterViewInit, OnDestroy, OnChanges\n{\n @Input() id?: string\n @Input() text?: string\n @Input() loop?: boolean\n @Input() options: DropdownOption[] = []\n\n @ViewChild('togglerRef') public togglerRef:\n | ElementRef<HTMLElement>\n | undefined\n\n @ViewChild('listboxRef') public listboxRef:\n | ElementRef<HTMLElement>\n | undefined\n\n value: any = undefined\n onChangeFn?: any\n onTouchedFn?: any\n\n dropdown?: AbstractDropdown\n handler?: DropdownHandler\n toggler?: Partial<ElementProps>\n listbox?: Partial<ElementProps>\n\n constructor(private cd: ChangeDetectorRef) {}\n\n ngAfterViewInit(): void {\n if (this.togglerRef?.nativeElement && this.listboxRef?.nativeElement) {\n this.handler = createDropdown(\n this.props,\n this.togglerRef.nativeElement,\n this.listboxRef.nativeElement,\n (dropdown) => {\n this.dropdown = dropdown\n this.toggler = dropdown.elements.toggler\n this.listbox = dropdown.elements.listbox\n this.cd.detectChanges()\n }\n )\n\n this.selectFromValue(this.value)\n }\n }\n\n ngOnDestroy(): void {\n this.handler?.destroy()\n }\n\n ngOnChanges(): void {\n if (this.handler && this.dropdown) {\n this.handler.update(this.props)\n }\n }\n\n writeValue(obj: any): void {\n this.value = obj\n this.selectFromValue(this.value)\n }\n\n registerOnChange(fn: any): void {\n this.onChangeFn = fn\n }\n\n registerOnTouched(fn: any): void {\n this.onTouchedFn = fn\n }\n\n select(option: ExtendedDropdownOption) {\n this.handler?.select(option)\n this.onChangeFn && this.onChangeFn(option.value)\n this.onTouchedFn && this.onTouchedFn()\n }\n\n trackByKey = (index: number, option: ExtendedDropdownOption): string => {\n return option.key\n }\n\n private get props(): DropdownArgs {\n return {\n id: this.id,\n text: this.text,\n options: this.options,\n loop: this.loop,\n }\n }\n\n private selectFromValue(value: any) {\n if (this.handler && value !== undefined) {\n const option = this.handler.dropdown.options.find(\n (option) => option.value === value\n )\n if (option) this.handler?.select(option)\n }\n }\n}\n","import { NgModule } from '@angular/core'\nimport { CommonModule } from '@angular/common'\nimport { NggDropdownComponent } from './dropdown.component'\n\n@NgModule({\n declarations: [NggDropdownComponent],\n imports: [CommonModule],\n exports: [NggDropdownComponent],\n})\nexport class NggDropdownModule {}\n","import { NgModule } from '@angular/core'\nimport { CommonModule } from '@angular/common'\nimport { NggSegmentedControlModule } from './segmented-control/segmented-control.module'\nimport { NggDropdownModule } from './dropdown/dropdown.module'\n\n@NgModule({\n declarations: [],\n imports: [CommonModule],\n exports: [NggSegmentedControlModule, NggDropdownModule],\n})\nexport class NggModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;MAsBa,4BAA4B;;yHAA5B,4BAA4B;6GAA5B,4BAA4B,iGAd7B;;;;;;;;;;GAUT;2FAIU,4BAA4B;kBAhBxC,SAAS;mBAAC;oBACT,QAAQ,EAAE,uBAAuB;oBACjC,QAAQ,EAAE;;;;;;;;;;GAUT;oBACD,MAAM,EAAE,EAAE;oBACV,eAAe,EAAE,uBAAuB,CAAC,MAAM;iBAChD;8BAEU,SAAS;sBAAjB,KAAK;;;MCbK,yBAAyB;;sHAAzB,yBAAyB;uHAAzB,yBAAyB,iBAJrB,4BAA4B,aACjC,YAAY,EAAE,YAAY,aAC1B,4BAA4B;uHAE3B,yBAAyB,YAH3B,CAAC,YAAY,EAAE,YAAY,CAAC;2FAG1B,yBAAyB;kBALrC,QAAQ;mBAAC;oBACR,YAAY,EAAE,CAAC,4BAA4B,CAAC;oBAC5C,OAAO,EAAE,CAAC,YAAY,EAAE,YAAY,CAAC;oBACrC,OAAO,EAAE,CAAC,4BAA4B,CAAC;iBACxC;;;MCwEY,oBAA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4BACE,OAAO,EAAE,iBAAiB;4BAC1B,WAAW,sBAAsB;4BACjC,KAAK,EAAE,IAAI;yBACZ;qBACF;oBACD,eAAe,EAAE,uBAAuB,CAAC,MAAM;iBAChD;wGAIU,EAAE;sBAAV,KAAK;gBACG,IAAI;sBAAZ,KAAK;gBACG,IAAI;sBAAZ,KAAK;gBACG,OAAO;sBAAf,KAAK;gBAE0B,UAAU;sBAAzC,SAAS;uBAAC,YAAY;gBAIS,UAAU;sBAAzC,SAAS;uBAAC,YAAY;;;MCpFZ,iBAAiB;;8GAAjB,iBAAiB;+GAAjB,iBAAiB,iBAJb,oBAAoB,aACzB,YAAY,aACZ,oBAAoB;+GAEnB,iBAAiB,YAHnB,CAAC,YAAY,CAAC;2FAGZ,iBAAiB;kBAL7B,QAAQ;mBAAC;oBACR,YAAY,EAAE,CAAC,oBAAoB,CAAC;oBACpC,OAAO,EAAE,CAAC,YAAY,CAAC;oBACvB,OAAO,EAAE,CAAC,oBAAoB,CAAC;iBAChC;;;MCEY,SAAS;;sGAAT,SAAS;uGAAT,SAAS,YAHV,YAAY,aACZ,yBAAyB,EAAE,iBAAiB;uGAE3C,SAAS,YAHX,CAAC,YAAY,CAAC,EACb,yBAAyB,EAAE,iBAAiB;2FAE3C,SAAS;kBALrB,QAAQ;mBAAC;oBACR,YAAY,EAAE,EAAE;oBAChB,OAAO,EAAE,CAAC,YAAY,CAAC;oBACvB,OAAO,EAAE,CAAC,yBAAyB,EAAE,iBAAiB,CAAC;iBACxD;;;ACTD;;;;;;"}
@@ -0,0 +1,284 @@
1
+ import * as i0 from '@angular/core';
2
+ import { Component, ChangeDetectionStrategy, Input, NgModule, ViewChild } from '@angular/core';
3
+ import * as i1 from '@angular/common';
4
+ import { CommonModule } from '@angular/common';
5
+ import * as i2 from '@angular/router';
6
+ import { RouterModule } from '@angular/router';
7
+ import { NG_VALUE_ACCESSOR } from '@angular/forms';
8
+ import { createDropdown } from '@sebgroup/extract';
9
+
10
+ class NggSegmentedControlComponent {
11
+ }
12
+ NggSegmentedControlComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: NggSegmentedControlComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
13
+ NggSegmentedControlComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.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.1.2", ngImport: i0, type: NggSegmentedControlComponent, decorators: [{
25
+ type: Component,
26
+ args: [{
27
+ selector: 'ngg-segmented-control',
28
+ 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>
38
+ `,
39
+ styles: [],
40
+ changeDetection: ChangeDetectionStrategy.OnPush,
41
+ }]
42
+ }], propDecorators: { $controls: [{
43
+ type: Input
44
+ }] } });
45
+
46
+ class NggSegmentedControlModule {
47
+ }
48
+ NggSegmentedControlModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: NggSegmentedControlModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
49
+ NggSegmentedControlModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: NggSegmentedControlModule, declarations: [NggSegmentedControlComponent], imports: [RouterModule, CommonModule], exports: [NggSegmentedControlComponent] });
50
+ NggSegmentedControlModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: NggSegmentedControlModule, imports: [[RouterModule, CommonModule]] });
51
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: NggSegmentedControlModule, decorators: [{
52
+ type: NgModule,
53
+ args: [{
54
+ declarations: [NggSegmentedControlComponent],
55
+ imports: [RouterModule, CommonModule],
56
+ exports: [NggSegmentedControlComponent],
57
+ }]
58
+ }] });
59
+
60
+ class NggDropdownComponent {
61
+ constructor(cd) {
62
+ this.cd = cd;
63
+ this.options = [];
64
+ this.value = undefined;
65
+ this.trackByKey = (index, option) => {
66
+ return option.key;
67
+ };
68
+ }
69
+ ngAfterViewInit() {
70
+ if (this.togglerRef?.nativeElement && this.listboxRef?.nativeElement) {
71
+ this.handler = createDropdown(this.props, this.togglerRef.nativeElement, this.listboxRef.nativeElement, (dropdown) => {
72
+ this.dropdown = dropdown;
73
+ this.toggler = dropdown.elements.toggler;
74
+ this.listbox = dropdown.elements.listbox;
75
+ this.cd.detectChanges();
76
+ });
77
+ this.selectFromValue(this.value);
78
+ }
79
+ }
80
+ ngOnDestroy() {
81
+ this.handler?.destroy();
82
+ }
83
+ ngOnChanges() {
84
+ if (this.handler && this.dropdown) {
85
+ this.handler.update(this.props);
86
+ }
87
+ }
88
+ writeValue(obj) {
89
+ this.value = obj;
90
+ this.selectFromValue(this.value);
91
+ }
92
+ registerOnChange(fn) {
93
+ this.onChangeFn = fn;
94
+ }
95
+ registerOnTouched(fn) {
96
+ this.onTouchedFn = fn;
97
+ }
98
+ select(option) {
99
+ this.handler?.select(option);
100
+ this.onChangeFn && this.onChangeFn(option.value);
101
+ this.onTouchedFn && this.onTouchedFn();
102
+ }
103
+ get props() {
104
+ return {
105
+ id: this.id,
106
+ text: this.text,
107
+ options: this.options,
108
+ loop: this.loop,
109
+ };
110
+ }
111
+ selectFromValue(value) {
112
+ if (this.handler && value !== undefined) {
113
+ const option = this.handler.dropdown.options.find((option) => option.value === value);
114
+ if (option)
115
+ this.handler?.select(option);
116
+ }
117
+ }
118
+ }
119
+ NggDropdownComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: NggDropdownComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
120
+ NggDropdownComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.2", type: NggDropdownComponent, selector: "ngg-dropdown", inputs: { id: "id", text: "text", loop: "loop", options: "options" }, providers: [
121
+ {
122
+ provide: NG_VALUE_ACCESSOR,
123
+ useExisting: NggDropdownComponent,
124
+ multi: true,
125
+ },
126
+ ], viewQueries: [{ propertyName: "togglerRef", first: true, predicate: ["togglerRef"], descendants: true }, { propertyName: "listboxRef", first: true, predicate: ["listboxRef"], descendants: true }], usesOnChanges: true, ngImport: i0, template: `
127
+ <div>
128
+ <button
129
+ #togglerRef
130
+ [id]="toggler?.attributes?.id"
131
+ [attr.aria-haspopup]="toggler?.attributes?.['aria-haspopup']"
132
+ [attr.aria-expanded]="toggler?.attributes?.['aria-expanded']"
133
+ [attr.aria-owns]="toggler?.attributes?.['aria-owns']"
134
+ [tabindex]="toggler?.attributes?.tabIndex"
135
+ [style]="toggler?.attributes?.style"
136
+ [class]="toggler?.classes"
137
+ (click)="handler?.toggle()"
138
+ >
139
+ {{ dropdown?.text }}
140
+ </button>
141
+ <div
142
+ #listboxRef
143
+ [id]="listbox?.attributes?.id"
144
+ [attr.role]="listbox?.attributes?.role"
145
+ [attr.aria-activedescendant]="
146
+ listbox?.attributes?.['aria-activedescendant']
147
+ "
148
+ [tabindex]="listbox?.attributes?.tabIndex"
149
+ [style]="listbox?.attributes?.style"
150
+ [class]="listbox?.classes"
151
+ >
152
+ <button
153
+ class="close m-4 m-sm-2 d-block d-sm-none"
154
+ (click)="handler?.close()"
155
+ >
156
+ <span class="sr-only">Close</span>
157
+ </button>
158
+ <ul role="listbox">
159
+ <li
160
+ *ngFor="let option of dropdown?.options; trackBy: trackByKey"
161
+ [id]="option.attributes.id"
162
+ [attr.role]="option.attributes.role"
163
+ [attr.aria-selected]="option.attributes['aria-selected']"
164
+ [style]="option.attributes.style"
165
+ [class]="option.classes"
166
+ (click)="select(option)"
167
+ >
168
+ {{ option.key }}
169
+ </li>
170
+ </ul>
171
+ </div>
172
+ </div>
173
+ `, isInline: true, directives: [{ type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
174
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: NggDropdownComponent, decorators: [{
175
+ type: Component,
176
+ args: [{
177
+ selector: 'ngg-dropdown',
178
+ template: `
179
+ <div>
180
+ <button
181
+ #togglerRef
182
+ [id]="toggler?.attributes?.id"
183
+ [attr.aria-haspopup]="toggler?.attributes?.['aria-haspopup']"
184
+ [attr.aria-expanded]="toggler?.attributes?.['aria-expanded']"
185
+ [attr.aria-owns]="toggler?.attributes?.['aria-owns']"
186
+ [tabindex]="toggler?.attributes?.tabIndex"
187
+ [style]="toggler?.attributes?.style"
188
+ [class]="toggler?.classes"
189
+ (click)="handler?.toggle()"
190
+ >
191
+ {{ dropdown?.text }}
192
+ </button>
193
+ <div
194
+ #listboxRef
195
+ [id]="listbox?.attributes?.id"
196
+ [attr.role]="listbox?.attributes?.role"
197
+ [attr.aria-activedescendant]="
198
+ listbox?.attributes?.['aria-activedescendant']
199
+ "
200
+ [tabindex]="listbox?.attributes?.tabIndex"
201
+ [style]="listbox?.attributes?.style"
202
+ [class]="listbox?.classes"
203
+ >
204
+ <button
205
+ class="close m-4 m-sm-2 d-block d-sm-none"
206
+ (click)="handler?.close()"
207
+ >
208
+ <span class="sr-only">Close</span>
209
+ </button>
210
+ <ul role="listbox">
211
+ <li
212
+ *ngFor="let option of dropdown?.options; trackBy: trackByKey"
213
+ [id]="option.attributes.id"
214
+ [attr.role]="option.attributes.role"
215
+ [attr.aria-selected]="option.attributes['aria-selected']"
216
+ [style]="option.attributes.style"
217
+ [class]="option.classes"
218
+ (click)="select(option)"
219
+ >
220
+ {{ option.key }}
221
+ </li>
222
+ </ul>
223
+ </div>
224
+ </div>
225
+ `,
226
+ providers: [
227
+ {
228
+ provide: NG_VALUE_ACCESSOR,
229
+ useExisting: NggDropdownComponent,
230
+ multi: true,
231
+ },
232
+ ],
233
+ changeDetection: ChangeDetectionStrategy.OnPush,
234
+ }]
235
+ }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { id: [{
236
+ type: Input
237
+ }], text: [{
238
+ type: Input
239
+ }], loop: [{
240
+ type: Input
241
+ }], options: [{
242
+ type: Input
243
+ }], togglerRef: [{
244
+ type: ViewChild,
245
+ args: ['togglerRef']
246
+ }], listboxRef: [{
247
+ type: ViewChild,
248
+ args: ['listboxRef']
249
+ }] } });
250
+
251
+ class NggDropdownModule {
252
+ }
253
+ NggDropdownModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: NggDropdownModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
254
+ NggDropdownModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: NggDropdownModule, declarations: [NggDropdownComponent], imports: [CommonModule], exports: [NggDropdownComponent] });
255
+ NggDropdownModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: NggDropdownModule, imports: [[CommonModule]] });
256
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: NggDropdownModule, decorators: [{
257
+ type: NgModule,
258
+ args: [{
259
+ declarations: [NggDropdownComponent],
260
+ imports: [CommonModule],
261
+ exports: [NggDropdownComponent],
262
+ }]
263
+ }] });
264
+
265
+ class NggModule {
266
+ }
267
+ NggModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: NggModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
268
+ NggModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: NggModule, imports: [CommonModule], exports: [NggSegmentedControlModule, NggDropdownModule] });
269
+ NggModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: NggModule, imports: [[CommonModule], NggSegmentedControlModule, NggDropdownModule] });
270
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: NggModule, decorators: [{
271
+ type: NgModule,
272
+ args: [{
273
+ declarations: [],
274
+ imports: [CommonModule],
275
+ exports: [NggSegmentedControlModule, NggDropdownModule],
276
+ }]
277
+ }] });
278
+
279
+ /**
280
+ * Generated bundle index. Do not edit.
281
+ */
282
+
283
+ export { NggDropdownComponent, NggDropdownModule, NggModule, NggSegmentedControlComponent, NggSegmentedControlModule };
284
+ //# sourceMappingURL=sebgroup-green-angular.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sebgroup-green-angular.mjs","sources":["../../../../libs/angular/src/lib/segmented-control/segmented-control.component.ts","../../../../libs/angular/src/lib/segmented-control/segmented-control.module.ts","../../../../libs/angular/src/lib/dropdown/dropdown.component.ts","../../../../libs/angular/src/lib/dropdown/dropdown.module.ts","../../../../libs/angular/src/lib/green-angular.module.ts","../../../../libs/angular/src/sebgroup-green-angular.ts"],"sourcesContent":["import { Component, ChangeDetectionStrategy, Input } from '@angular/core'\nimport { Observable } from 'rxjs'\nexport interface SegmentedControl {\n url: string\n text: Observable<string> | string\n}\n@Component({\n selector: 'ngg-segmented-control',\n template: `\n <div class=\"group\">\n <a\n *ngFor=\"let control of $controls | async\"\n [routerLink]=\"control.url\"\n routerLinkActive=\"active\"\n class=\"button\"\n >{{ control.text }}</a\n >\n </div>\n `,\n styles: [],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class NggSegmentedControlComponent {\n @Input() $controls: Observable<Array<SegmentedControl>> | undefined\n}\n","import { NgModule } from '@angular/core'\nimport { CommonModule } from '@angular/common'\nimport { NggSegmentedControlComponent } from './segmented-control.component'\nimport { RouterModule } from '@angular/router'\n\n@NgModule({\n declarations: [NggSegmentedControlComponent],\n imports: [RouterModule, CommonModule],\n exports: [NggSegmentedControlComponent],\n})\nexport class NggSegmentedControlModule {}\n","import {\n AfterViewInit,\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n ElementRef,\n Input,\n OnChanges,\n OnDestroy,\n ViewChild,\n} from '@angular/core'\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'\nimport {\n createDropdown,\n AbstractDropdown,\n DropdownHandler,\n DropdownOption,\n ExtendedDropdownOption,\n ElementProps,\n DropdownArgs,\n} from '@sebgroup/extract'\n\n@Component({\n selector: 'ngg-dropdown',\n template: `\n <div>\n <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 >\n {{ dropdown?.text }}\n </button>\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 class=\"close m-4 m-sm-2 d-block d-sm-none\"\n (click)=\"handler?.close()\"\n >\n <span class=\"sr-only\">Close</span>\n </button>\n <ul role=\"listbox\">\n <li\n *ngFor=\"let option of dropdown?.options; trackBy: trackByKey\"\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)=\"select(option)\"\n >\n {{ option.key }}\n </li>\n </ul>\n </div>\n </div>\n `,\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: NggDropdownComponent,\n multi: true,\n },\n ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class NggDropdownComponent\n implements ControlValueAccessor, AfterViewInit, OnDestroy, OnChanges\n{\n @Input() id?: string\n @Input() text?: string\n @Input() loop?: boolean\n @Input() options: DropdownOption[] = []\n\n @ViewChild('togglerRef') public togglerRef:\n | ElementRef<HTMLElement>\n | undefined\n\n @ViewChild('listboxRef') public listboxRef:\n | ElementRef<HTMLElement>\n | undefined\n\n value: any = undefined\n onChangeFn?: any\n onTouchedFn?: any\n\n dropdown?: AbstractDropdown\n handler?: DropdownHandler\n toggler?: Partial<ElementProps>\n listbox?: Partial<ElementProps>\n\n constructor(private cd: ChangeDetectorRef) {}\n\n ngAfterViewInit(): void {\n if (this.togglerRef?.nativeElement && this.listboxRef?.nativeElement) {\n this.handler = createDropdown(\n this.props,\n this.togglerRef.nativeElement,\n this.listboxRef.nativeElement,\n (dropdown) => {\n this.dropdown = dropdown\n this.toggler = dropdown.elements.toggler\n this.listbox = dropdown.elements.listbox\n this.cd.detectChanges()\n }\n )\n\n this.selectFromValue(this.value)\n }\n }\n\n ngOnDestroy(): void {\n this.handler?.destroy()\n }\n\n ngOnChanges(): void {\n if (this.handler && this.dropdown) {\n this.handler.update(this.props)\n }\n }\n\n writeValue(obj: any): void {\n this.value = obj\n this.selectFromValue(this.value)\n }\n\n registerOnChange(fn: any): void {\n this.onChangeFn = fn\n }\n\n registerOnTouched(fn: any): void {\n this.onTouchedFn = fn\n }\n\n select(option: ExtendedDropdownOption) {\n this.handler?.select(option)\n this.onChangeFn && this.onChangeFn(option.value)\n this.onTouchedFn && this.onTouchedFn()\n }\n\n trackByKey = (index: number, option: ExtendedDropdownOption): string => {\n return option.key\n }\n\n private get props(): DropdownArgs {\n return {\n id: this.id,\n text: this.text,\n options: this.options,\n loop: this.loop,\n }\n }\n\n private selectFromValue(value: any) {\n if (this.handler && value !== undefined) {\n const option = this.handler.dropdown.options.find(\n (option) => option.value === value\n )\n if (option) this.handler?.select(option)\n }\n }\n}\n","import { NgModule } from '@angular/core'\nimport { CommonModule } from '@angular/common'\nimport { NggDropdownComponent } from './dropdown.component'\n\n@NgModule({\n declarations: [NggDropdownComponent],\n imports: [CommonModule],\n exports: [NggDropdownComponent],\n})\nexport class NggDropdownModule {}\n","import { NgModule } from '@angular/core'\nimport { CommonModule } from '@angular/common'\nimport { NggSegmentedControlModule } from './segmented-control/segmented-control.module'\nimport { NggDropdownModule } from './dropdown/dropdown.module'\n\n@NgModule({\n declarations: [],\n imports: [CommonModule],\n exports: [NggSegmentedControlModule, NggDropdownModule],\n})\nexport class NggModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;MAsBa,4BAA4B;;yHAA5B,4BAA4B;6GAA5B,4BAA4B,iGAd7B;;;;;;;;;;GAUT;2FAIU,4BAA4B;kBAhBxC,SAAS;mBAAC;oBACT,QAAQ,EAA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ALrB,QAAQ;mBAAC;oBACR,YAAY,EAAE,EAAE;oBAChB,OAAO,EAAE,CAAC,YAAY,CAAC;oBACvB,OAAO,EAAE,CAAC,yBAAyB,EAAE,iBAAiB,CAAC;iBACxD;;;ACTD;;;;;;"}
package/index.d.ts CHANGED
@@ -1,9 +1,5 @@
1
1
  export * from './lib/green-angular.module';
2
2
  export * from './lib/dropdown/dropdown.module';
3
3
  export * from './lib/dropdown/dropdown.component';
4
- export * from './lib/dropdown/popover.directive';
5
- export * from './lib/dropdown/popover-element.directive';
6
- export * from './lib/dropdown/popover-option.directive';
7
- export * from './lib/dropdown/popover-trigger.directive';
8
4
  export * from './lib/segmented-control/segmented-control.module';
9
5
  export * from './lib/segmented-control/segmented-control.component';
@@ -1,19 +1,33 @@
1
+ import { AfterViewInit, ChangeDetectorRef, ElementRef, OnChanges, OnDestroy } from '@angular/core';
1
2
  import { ControlValueAccessor } from '@angular/forms';
3
+ import { AbstractDropdown, DropdownHandler, DropdownOption, ExtendedDropdownOption, ElementProps } from '@sebgroup/extract';
2
4
  import * as i0 from "@angular/core";
3
- export declare class NggDropdownComponent implements ControlValueAccessor {
4
- get options(): Array<any>;
5
- set options(value: Array<any>);
6
- get config(): any;
7
- set config(value: any);
5
+ export declare class NggDropdownComponent implements ControlValueAccessor, AfterViewInit, OnDestroy, OnChanges {
6
+ private cd;
7
+ id?: string;
8
+ text?: string;
9
+ loop?: boolean;
10
+ options: DropdownOption[];
11
+ togglerRef: ElementRef<HTMLElement> | undefined;
12
+ listboxRef: ElementRef<HTMLElement> | undefined;
8
13
  value: any;
9
- onChangeFn: any;
10
- onTouchedFn: any;
11
- private _options;
12
- private _config?;
14
+ onChangeFn?: any;
15
+ onTouchedFn?: any;
16
+ dropdown?: AbstractDropdown;
17
+ handler?: DropdownHandler;
18
+ toggler?: Partial<ElementProps>;
19
+ listbox?: Partial<ElementProps>;
20
+ constructor(cd: ChangeDetectorRef);
21
+ ngAfterViewInit(): void;
22
+ ngOnDestroy(): void;
23
+ ngOnChanges(): void;
13
24
  writeValue(obj: any): void;
14
25
  registerOnChange(fn: any): void;
15
26
  registerOnTouched(fn: any): void;
16
- select(value: any): void;
27
+ select(option: ExtendedDropdownOption): void;
28
+ trackByKey: (index: number, option: ExtendedDropdownOption) => string;
29
+ private get props();
30
+ private selectFromValue;
17
31
  static ɵfac: i0.ɵɵFactoryDeclaration<NggDropdownComponent, never>;
18
- static ɵcmp: i0.ɵɵComponentDeclaration<NggDropdownComponent, "ngg-dropdown", never, { "options": "options"; "config": "config"; }, {}, never, never>;
32
+ static ɵcmp: i0.ɵɵComponentDeclaration<NggDropdownComponent, "ngg-dropdown", never, { "id": "id"; "text": "text"; "loop": "loop"; "options": "options"; }, {}, never, never>;
19
33
  }
@@ -1,12 +1,8 @@
1
1
  import * as i0 from "@angular/core";
2
- import * as i1 from "./popover.directive";
3
- import * as i2 from "./popover-option.directive";
4
- import * as i3 from "./popover-element.directive";
5
- import * as i4 from "./popover-trigger.directive";
6
- import * as i5 from "./dropdown.component";
7
- import * as i6 from "@angular/common";
2
+ import * as i1 from "./dropdown.component";
3
+ import * as i2 from "@angular/common";
8
4
  export declare class NggDropdownModule {
9
5
  static ɵfac: i0.ɵɵFactoryDeclaration<NggDropdownModule, never>;
10
- static ɵmod: i0.ɵɵNgModuleDeclaration<NggDropdownModule, [typeof i1.NggPopoverDirective, typeof i2.NggPopoverOptionDirective, typeof i3.NggPopoverElementDirective, typeof i4.NggPopoverTriggerDirective, typeof i5.NggDropdownComponent], [typeof i6.CommonModule], [typeof i1.NggPopoverDirective, typeof i2.NggPopoverOptionDirective, typeof i3.NggPopoverElementDirective, typeof i4.NggPopoverTriggerDirective, typeof i5.NggDropdownComponent]>;
6
+ static ɵmod: i0.ɵɵNgModuleDeclaration<NggDropdownModule, [typeof i1.NggDropdownComponent], [typeof i2.CommonModule], [typeof i1.NggDropdownComponent]>;
11
7
  static ɵinj: i0.ɵɵInjectorDeclaration<NggDropdownModule>;
12
8
  }
package/package.json CHANGED
@@ -1,19 +1,22 @@
1
1
  {
2
2
  "name": "@sebgroup/green-angular",
3
- "version": "1.0.0-beta.1",
3
+ "version": "1.0.0-beta.5",
4
4
  "peerDependencies": {
5
- "@angular/common": "^12.1.0",
6
- "@angular/core": "^12.1.0",
7
- "@angular/forms": "12.2.10",
8
- "@angular/platform-browser": "12.2.10",
5
+ "@angular/common": "^12.0.0 || ^13.0.0",
6
+ "@angular/core": "^12.0.0 || ^13.0.0",
7
+ "body-scroll-lock": "^4.0.0-beta.0",
8
+ "merge": "^2.1.1",
9
+ "@popperjs/core": "^2.11.0",
9
10
  "rxjs": "^6.6.7",
10
- "@popperjs/core": "^2.10.2",
11
- "@angular/router": "12.2.10"
11
+ "react": "^17.0.2",
12
+ "@angular/forms": "13.1.2",
13
+ "@angular/platform-browser": "13.1.2",
14
+ "@angular/router": "13.1.2"
12
15
  },
13
16
  "dependencies": {
14
- "@sebgroup/chlorophyll": "^1.0.0-beta.1",
15
- "body-scroll-lock": "^4.0.0-beta.0",
16
- "tslib": "^2.2.0"
17
+ "@sebgroup/chlorophyll": "^1.0.0-beta.5",
18
+ "@sebgroup/extract": "^1.0.0-beta.5",
19
+ "tslib": "^2.3.1"
17
20
  },
18
21
  "description": "Angular components built on top of @sebgroup/chlorophyll.",
19
22
  "repository": {
@@ -31,11 +34,24 @@
31
34
  "url": "https://github.com/sebgroup/green/labels/angular"
32
35
  },
33
36
  "homepage": "https://sebgroup.github.io/green/latest/angular/",
34
- "main": "bundles/sebgroup-green-angular.umd.js",
35
- "module": "fesm2015/sebgroup-green-angular.js",
36
- "es2015": "fesm2015/sebgroup-green-angular.js",
37
- "esm2015": "esm2015/sebgroup-green-angular.js",
38
- "fesm2015": "fesm2015/sebgroup-green-angular.js",
37
+ "module": "fesm2015/sebgroup-green-angular.mjs",
38
+ "es2020": "fesm2020/sebgroup-green-angular.mjs",
39
+ "esm2020": "esm2020/sebgroup-green-angular.mjs",
40
+ "fesm2020": "fesm2020/sebgroup-green-angular.mjs",
41
+ "fesm2015": "fesm2015/sebgroup-green-angular.mjs",
39
42
  "typings": "sebgroup-green-angular.d.ts",
43
+ "exports": {
44
+ "./package.json": {
45
+ "default": "./package.json"
46
+ },
47
+ ".": {
48
+ "types": "./sebgroup-green-angular.d.ts",
49
+ "esm2020": "./esm2020/sebgroup-green-angular.mjs",
50
+ "es2020": "./fesm2020/sebgroup-green-angular.mjs",
51
+ "es2015": "./fesm2015/sebgroup-green-angular.mjs",
52
+ "node": "./fesm2015/sebgroup-green-angular.mjs",
53
+ "default": "./fesm2020/sebgroup-green-angular.mjs"
54
+ }
55
+ },
40
56
  "sideEffects": false
41
57
  }