@cqa-lib/cqa-ui 0.1.1 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (121) hide show
  1. package/esm2020/lib/action-menu/action-menu.component.mjs +42 -0
  2. package/esm2020/lib/assets/images/image-assets.constants.mjs +28 -0
  3. package/esm2020/lib/badge/badge.component.mjs +141 -0
  4. package/esm2020/lib/button/button.component.mjs +232 -0
  5. package/esm2020/lib/column-visibility/column-visibility.component.mjs +69 -0
  6. package/esm2020/lib/dashboards/chart-card/chart-card.component.mjs +22 -0
  7. package/esm2020/lib/dashboards/coverage-module-card/coverage-module-card.component.mjs +104 -0
  8. package/esm2020/lib/dashboards/dashboard-header/dashboard-header.component.mjs +82 -0
  9. package/esm2020/lib/dashboards/failed-test-cases-card/failed-test-cases-card.component.mjs +60 -0
  10. package/esm2020/lib/dashboards/heat-error-map-cell/heat-error-map-cell.component.mjs +45 -0
  11. package/esm2020/lib/dashboards/insight-card/insight-card.component.mjs +201 -0
  12. package/esm2020/lib/dashboards/metrics-card/metrics-block.component.mjs +41 -0
  13. package/esm2020/lib/dashboards/metrics-card/metrics-card-item.interface.mjs +2 -0
  14. package/esm2020/lib/dashboards/metrics-card/metrics-card.component.mjs +62 -0
  15. package/esm2020/lib/dashboards/progress-text-card/progress-text-card.component.mjs +46 -0
  16. package/esm2020/lib/dashboards/test-distribution-card/test-distribution-card.component.mjs +35 -0
  17. package/esm2020/lib/dialog/dialog.component.mjs +127 -0
  18. package/esm2020/lib/dropdown-button/dropdown-button.component.mjs +189 -0
  19. package/esm2020/lib/dynamic-select/dynamic-select-field.component.mjs +160 -0
  20. package/esm2020/lib/empty-state/empty-state.component.mjs +37 -0
  21. package/esm2020/lib/filters/dynamic-filter/dynamic-filter.component.mjs +239 -0
  22. package/esm2020/lib/full-table-loader/full-table-loader.component.mjs +16 -0
  23. package/esm2020/lib/inline-sort/inline-sort.component.mjs +58 -0
  24. package/esm2020/lib/other-button/other-button.component.mjs +76 -0
  25. package/esm2020/lib/pagination/pagination.component.mjs +102 -0
  26. package/{dist/cqa-ui/esm2020 → esm2020}/lib/search-bar/search-bar.component.mjs +3 -3
  27. package/{dist/cqa-ui/esm2020 → esm2020}/lib/segment-control/segment-control.component.mjs +3 -3
  28. package/esm2020/lib/selected-filters/selected-filters.component.mjs +27 -0
  29. package/esm2020/lib/table/dynamic-table/dynamic-cell.directive.mjs +35 -0
  30. package/esm2020/lib/table/dynamic-table/dynamic-table.component.mjs +258 -0
  31. package/esm2020/lib/table-action-toolbar/table-action-toolbar.component.mjs +52 -0
  32. package/esm2020/lib/table-data-loader/table-data-loader.component.mjs +19 -0
  33. package/esm2020/lib/templates/table-template.component.mjs +365 -0
  34. package/esm2020/lib/ui-kit.module.mjs +248 -0
  35. package/esm2020/lib/utils/metadata-colors.util.mjs +100 -0
  36. package/esm2020/lib/utils/tw-overlay-container.mjs +22 -0
  37. package/esm2020/public-api.mjs +38 -0
  38. package/fesm2015/cqa-lib-cqa-ui.mjs +3661 -0
  39. package/fesm2015/cqa-lib-cqa-ui.mjs.map +1 -0
  40. package/fesm2020/cqa-lib-cqa-ui.mjs +3615 -0
  41. package/fesm2020/cqa-lib-cqa-ui.mjs.map +1 -0
  42. package/lib/action-menu/action-menu.component.d.ts +17 -0
  43. package/lib/assets/images/image-assets.constants.d.ts +20 -0
  44. package/lib/badge/badge.component.d.ts +25 -0
  45. package/{dist/cqa-ui/lib → lib}/button/button.component.d.ts +6 -5
  46. package/lib/column-visibility/column-visibility.component.d.ts +33 -0
  47. package/lib/dashboards/chart-card/chart-card.component.d.ts +8 -0
  48. package/lib/dashboards/coverage-module-card/coverage-module-card.component.d.ts +44 -0
  49. package/lib/dashboards/dashboard-header/dashboard-header.component.d.ts +30 -0
  50. package/lib/dashboards/failed-test-cases-card/failed-test-cases-card.component.d.ts +28 -0
  51. package/lib/dashboards/heat-error-map-cell/heat-error-map-cell.component.d.ts +14 -0
  52. package/lib/dashboards/insight-card/insight-card.component.d.ts +73 -0
  53. package/lib/dashboards/metrics-card/metrics-block.component.d.ts +12 -0
  54. package/lib/dashboards/metrics-card/metrics-card-item.interface.d.ts +12 -0
  55. package/lib/dashboards/metrics-card/metrics-card.component.d.ts +17 -0
  56. package/lib/dashboards/progress-text-card/progress-text-card.component.d.ts +13 -0
  57. package/lib/dashboards/test-distribution-card/test-distribution-card.component.d.ts +29 -0
  58. package/lib/dropdown-button/dropdown-button.component.d.ts +32 -0
  59. package/lib/dynamic-select/dynamic-select-field.component.d.ts +43 -0
  60. package/lib/empty-state/empty-state.component.d.ts +20 -0
  61. package/lib/filters/dynamic-filter/dynamic-filter.component.d.ts +56 -0
  62. package/lib/full-table-loader/full-table-loader.component.d.ts +6 -0
  63. package/lib/inline-sort/inline-sort.component.d.ts +12 -0
  64. package/lib/other-button/other-button.component.d.ts +37 -0
  65. package/lib/pagination/pagination.component.d.ts +37 -0
  66. package/lib/selected-filters/selected-filters.component.d.ts +17 -0
  67. package/lib/table/dynamic-table/dynamic-cell.directive.d.ts +16 -0
  68. package/lib/table/dynamic-table/dynamic-table.component.d.ts +72 -0
  69. package/lib/table-action-toolbar/table-action-toolbar.component.d.ts +34 -0
  70. package/lib/table-data-loader/table-data-loader.component.d.ts +7 -0
  71. package/lib/templates/table-template.component.d.ts +90 -0
  72. package/lib/ui-kit.module.d.ts +52 -0
  73. package/lib/utils/metadata-colors.util.d.ts +50 -0
  74. package/lib/utils/tw-overlay-container.d.ts +12 -0
  75. package/package.json +23 -49
  76. package/public-api.d.ts +37 -0
  77. package/src/lib/assets/images/.gitkeep +0 -0
  78. package/src/lib/assets/images/DashboardIcon.png +0 -0
  79. package/src/lib/assets/images/FilesIcon.png +0 -0
  80. package/src/lib/assets/images/README.md +66 -0
  81. package/src/lib/assets/images/ReportsIcon.png +0 -0
  82. package/src/lib/assets/images/SearchIcon.png +0 -0
  83. package/src/lib/assets/images/StepsIcon.png +0 -0
  84. package/src/lib/assets/images/TestCaseIcon.png +0 -0
  85. package/src/lib/assets/images/analytics-chart-icon.svg +11 -0
  86. package/src/lib/assets/images/checklist-add-icon.svg +10 -0
  87. package/src/lib/assets/images/document-gear-icon.svg +9 -0
  88. package/src/lib/assets/images/empty-state-default-icon.svg +8 -0
  89. package/src/lib/assets/images/image-assets.constants.ts +38 -0
  90. package/src/lib/assets/images/search-debug-icon.svg +8 -0
  91. package/src/lib/assets/images/test-case-icon.svg +9 -0
  92. package/src/lib/assets/images/upload-folder-icon.svg +7 -0
  93. package/src/lib/utils/metadata-colors.constants.js +33 -0
  94. package/storybook-static/assets/images/README.md +66 -0
  95. package/styles.css +1 -0
  96. package/dist/cqa-ui/README.md +0 -226
  97. package/dist/cqa-ui/esm2020/lib/button/button.component.mjs +0 -257
  98. package/dist/cqa-ui/esm2020/lib/dialog/dialog.component.mjs +0 -127
  99. package/dist/cqa-ui/esm2020/lib/ui-kit.module.mjs +0 -69
  100. package/dist/cqa-ui/esm2020/public-api.mjs +0 -10
  101. package/dist/cqa-ui/fesm2015/cqa-lib-cqa-ui.mjs +0 -895
  102. package/dist/cqa-ui/fesm2015/cqa-lib-cqa-ui.mjs.map +0 -1
  103. package/dist/cqa-ui/fesm2020/cqa-lib-cqa-ui.mjs +0 -881
  104. package/dist/cqa-ui/fesm2020/cqa-lib-cqa-ui.mjs.map +0 -1
  105. package/dist/cqa-ui/lib/ui-kit.module.d.ts +0 -15
  106. package/dist/cqa-ui/package.json +0 -56
  107. package/dist/cqa-ui/public-api.d.ts +0 -9
  108. package/dist/cqa-ui/styles.css +0 -1
  109. /package/{dist/cqa-ui/cqa-lib-cqa-ui.d.ts → cqa-lib-cqa-ui.d.ts} +0 -0
  110. /package/{dist/cqa-ui/esm2020 → esm2020}/cqa-lib-cqa-ui.mjs +0 -0
  111. /package/{dist/cqa-ui/esm2020 → esm2020}/lib/dialog/dialog-ref.mjs +0 -0
  112. /package/{dist/cqa-ui/esm2020 → esm2020}/lib/dialog/dialog.models.mjs +0 -0
  113. /package/{dist/cqa-ui/esm2020 → esm2020}/lib/dialog/dialog.service.mjs +0 -0
  114. /package/{dist/cqa-ui/esm2020 → esm2020}/lib/dialog/dialog.tokens.mjs +0 -0
  115. /package/{dist/cqa-ui/lib → lib}/dialog/dialog-ref.d.ts +0 -0
  116. /package/{dist/cqa-ui/lib → lib}/dialog/dialog.component.d.ts +0 -0
  117. /package/{dist/cqa-ui/lib → lib}/dialog/dialog.models.d.ts +0 -0
  118. /package/{dist/cqa-ui/lib → lib}/dialog/dialog.service.d.ts +0 -0
  119. /package/{dist/cqa-ui/lib → lib}/dialog/dialog.tokens.d.ts +0 -0
  120. /package/{dist/cqa-ui/lib → lib}/search-bar/search-bar.component.d.ts +0 -0
  121. /package/{dist/cqa-ui/lib → lib}/segment-control/segment-control.component.d.ts +0 -0
@@ -1,895 +0,0 @@
1
- import * as i0 from '@angular/core';
2
- import { EventEmitter, Component, Input, Output, HostListener, ViewChildren, ViewChild, ChangeDetectionStrategy, NgModule, InjectionToken, Injector, Injectable } from '@angular/core';
3
- import * as i2 from '@angular/common';
4
- import { CommonModule } from '@angular/common';
5
- import * as i2$1 from '@angular/forms';
6
- import { FormsModule } from '@angular/forms';
7
- import * as i1 from '@angular/material/icon';
8
- import { MatIconModule } from '@angular/material/icon';
9
- import * as i1$1 from '@angular/cdk/overlay';
10
- import { OverlayModule, OverlayConfig } from '@angular/cdk/overlay';
11
- import * as i3 from '@angular/cdk/portal';
12
- import { TemplatePortal, CdkPortalOutlet, PortalModule, ComponentPortal } from '@angular/cdk/portal';
13
- import { __awaiter } from 'tslib';
14
- import { filter } from 'rxjs/operators';
15
- import { Subject } from 'rxjs';
16
-
17
- class ButtonComponent {
18
- constructor() {
19
- this.variant = 'filled';
20
- this.disabled = false;
21
- this.iconPosition = 'start';
22
- this.type = 'button';
23
- this.clicked = new EventEmitter();
24
- // Internal state tracking
25
- this.isHovered = false;
26
- this.isFocused = false;
27
- this.isPressed = false;
28
- }
29
- get hasIcon() {
30
- return !!this.icon;
31
- }
32
- get buttonClasses() {
33
- const baseClasses = [
34
- 'cqa-flex',
35
- 'cqa-flex-col',
36
- 'cqa-justify-center',
37
- 'cqa-items-center',
38
- 'cqa-p-0',
39
- 'cqa-gap-2',
40
- 'cqa-rounded-lg',
41
- 'cqa-cursor-pointer',
42
- 'cqa-font-inter',
43
- 'cqa-font-semibold',
44
- 'cqa-text-sm',
45
- 'cqa-leading-[14px]',
46
- 'cqa-transition-all',
47
- 'cqa-duration-200',
48
- 'cqa-outline-none'
49
- ];
50
- if (this.disabled) {
51
- baseClasses.push('cqa-cursor-not-allowed');
52
- }
53
- // Add variant and state specific classes
54
- const variantClasses = this.getVariantClasses();
55
- return [...baseClasses, ...variantClasses].join(' ');
56
- }
57
- get stateLayerClasses() {
58
- const classes = [
59
- 'cqa-flex',
60
- 'cqa-flex-row',
61
- 'cqa-justify-center',
62
- 'cqa-items-center',
63
- 'cqa-gap-2',
64
- 'cqa-w-full',
65
- 'cqa-h-full',
66
- 'cqa-py-[10px]',
67
- 'cqa-px-6',
68
- ];
69
- return classes.join(' ');
70
- }
71
- get labelClasses() {
72
- const classes = [
73
- 'cqa-flex',
74
- 'cqa-items-center',
75
- 'cqa-text-center',
76
- 'cqa-font-inter',
77
- 'cqa-font-semibold',
78
- 'cqa-text-sm',
79
- 'cqa-leading-[14px]',
80
- 'cqa-flex-none',
81
- this.textClass,
82
- ];
83
- if (this.disabled) {
84
- classes.push('cqa-opacity-[0.38]');
85
- }
86
- return classes.join(' ');
87
- }
88
- get iconClasses() {
89
- const classes = [
90
- 'cqa-flex',
91
- 'cqa-items-center',
92
- 'cqa-justify-center',
93
- 'cqa-w-[14px]',
94
- 'cqa-h-[14px]',
95
- 'cqa-shrink-0',
96
- 'cqa-flex-none'
97
- ];
98
- if (this.disabled) {
99
- classes.push('cqa-opacity-[0.38]');
100
- }
101
- return classes.join(' ');
102
- }
103
- getVariantClasses() {
104
- const classes = [];
105
- if (this.variant === 'filled') {
106
- if (this.disabled) {
107
- classes.push('cqa-bg-primary-muted');
108
- }
109
- else {
110
- classes.push('cqa-bg-primary');
111
- if (this.isHovered) {
112
- classes.push('cqa-shadow-[0px_1px_2px_rgba(0,0,0,0.3),0px_1px_3px_1px_rgba(0,0,0,0.15)]');
113
- }
114
- }
115
- }
116
- else if (this.variant === 'outlined') {
117
- if (this.disabled) {
118
- classes.push('cqa-bg-transparent', 'cqa-border', 'cqa-border-primary-muted');
119
- }
120
- else {
121
- if (this.isFocused) {
122
- classes.push('cqa-bg-primary-surface-alt', 'cqa-border', 'cqa-border-primary-hover', 'cqa-shadow-[0px_4px_4px_rgba(0,0,0,0.25)]');
123
- }
124
- else if (this.isHovered || this.isPressed) {
125
- classes.push('cqa-bg-primary-surface', 'cqa-border', 'cqa-border-primary');
126
- }
127
- else {
128
- classes.push('cqa-bg-transparent', 'cqa-border', 'cqa-border-slate');
129
- }
130
- }
131
- }
132
- else if (this.variant === 'text') {
133
- if (this.disabled) {
134
- classes.push('cqa-bg-transparent');
135
- }
136
- else {
137
- classes.push('cqa-bg-transparent');
138
- if (this.isHovered || this.isFocused || this.isPressed) {
139
- classes.push('cqa-bg-primary-surface');
140
- }
141
- }
142
- }
143
- else if (this.variant === 'elevated') {
144
- if (this.disabled) {
145
- classes.push('cqa-bg-primary-muted', 'cqa-shadow-none');
146
- }
147
- else {
148
- if (this.isFocused) {
149
- classes.push('cqa-bg-primary-surface-alt', 'cqa-shadow-[0px_4px_4px_rgba(0,0,0,0.25)]');
150
- }
151
- else if (this.isPressed) {
152
- classes.push('cqa-bg-primary-surface', 'cqa-shadow-[0px_1px_2px_rgba(0,0,0,0.3),0px_1px_3px_1px_rgba(0,0,0,0.15)]');
153
- }
154
- else if (this.isHovered) {
155
- classes.push('cqa-bg-primary-surface-alt', 'cqa-shadow-[0px_1px_2px_rgba(0,0,0,0.3),0px_2px_6px_2px_rgba(0,0,0,0.15)]');
156
- }
157
- else {
158
- classes.push('cqa-bg-primary-surface', 'cqa-shadow-[0px_1px_2px_rgba(0,0,0,0.3),0px_1px_3px_1px_rgba(0,0,0,0.15)]');
159
- }
160
- }
161
- }
162
- else if (this.variant === 'tonal') {
163
- if (this.disabled) {
164
- classes.push('cqa-bg-primary-muted');
165
- }
166
- else {
167
- if (this.isHovered) {
168
- classes.push('cqa-bg-tonal-hover', 'cqa-shadow-[0px_1px_2px_rgba(0,0,0,0.3),0px_1px_3px_1px_rgba(0,0,0,0.15)]');
169
- }
170
- else {
171
- classes.push('cqa-bg-primary-surface-alt');
172
- }
173
- }
174
- }
175
- return classes;
176
- }
177
- get textClass() {
178
- if (this.disabled) {
179
- if (this.variant === 'outlined' || this.variant === 'text') {
180
- return 'cqa-text-ink';
181
- }
182
- return 'cqa-text-ink-muted';
183
- }
184
- switch (this.variant) {
185
- case 'filled':
186
- return 'cqa-text-surface-default';
187
- case 'outlined':
188
- if (this.isFocused || this.isHovered || this.isPressed) {
189
- return 'cqa-text-primary-hover';
190
- }
191
- return 'cqa-text-slate';
192
- case 'text':
193
- case 'elevated':
194
- return 'cqa-text-primary-hover';
195
- case 'tonal':
196
- return 'cqa-text-ink';
197
- default:
198
- return '';
199
- }
200
- }
201
- onMouseEnter() {
202
- if (!this.disabled) {
203
- this.isHovered = true;
204
- }
205
- }
206
- onMouseLeave() {
207
- this.isHovered = false;
208
- this.isPressed = false;
209
- }
210
- onMouseDown() {
211
- if (!this.disabled) {
212
- this.isPressed = true;
213
- }
214
- }
215
- onMouseUp() {
216
- this.isPressed = false;
217
- }
218
- onFocus() {
219
- if (!this.disabled) {
220
- this.isFocused = true;
221
- }
222
- }
223
- onBlur() {
224
- this.isFocused = false;
225
- this.isPressed = false;
226
- }
227
- onClick(event) {
228
- if (!this.disabled) {
229
- this.clicked.emit(event);
230
- }
231
- }
232
- }
233
- ButtonComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: ButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
234
- ButtonComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.4.0", type: ButtonComponent, selector: "cqa-button", inputs: { variant: "variant", disabled: "disabled", icon: "icon", iconPosition: "iconPosition", type: "type" }, outputs: { clicked: "clicked" }, host: { listeners: { "mouseenter": "onMouseEnter()", "mouseleave": "onMouseLeave()", "mousedown": "onMouseDown()", "mouseup": "onMouseUp()", "focus": "onFocus()", "blur": "onBlur()" } }, ngImport: i0, template: "<div id=\"cqa-ui-root\" style=\"display: inline-block; width: auto;\">\n <button\n [type]=\"type\"\n [disabled]=\"disabled\"\n [attr.aria-disabled]=\"disabled\"\n [class]=\"buttonClasses\"\n (click)=\"onClick($event)\"\n >\n <span [class]=\"stateLayerClasses\">\n <span *ngIf=\"icon && iconPosition === 'start'\" [class]=\"iconClasses\" [ngClass]=\"textClass\">\n <mat-icon class=\"cqa-text-[18px] cqa-leading-[18px] cqa-w-[18px] cqa-h-[18px]\">\n {{ icon }}\n </mat-icon>\n </span>\n <span [class]=\"labelClasses\" [ngClass]=\"textClass\">\n <ng-content></ng-content>\n </span>\n <span *ngIf=\"icon && iconPosition === 'end'\" [class]=\"iconClasses\" [ngClass]=\"textClass\">\n <mat-icon class=\"cqa-text-[18px] cqa-leading-[18px] cqa-w-[18px] cqa-h-[18px]\">\n {{ icon }}\n </mat-icon>\n </span>\n </span>\n </button>\n</div>\n\n", components: [{ type: i1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }], directives: [{ type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] });
235
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: ButtonComponent, decorators: [{
236
- type: Component,
237
- args: [{ selector: 'cqa-button', template: "<div id=\"cqa-ui-root\" style=\"display: inline-block; width: auto;\">\n <button\n [type]=\"type\"\n [disabled]=\"disabled\"\n [attr.aria-disabled]=\"disabled\"\n [class]=\"buttonClasses\"\n (click)=\"onClick($event)\"\n >\n <span [class]=\"stateLayerClasses\">\n <span *ngIf=\"icon && iconPosition === 'start'\" [class]=\"iconClasses\" [ngClass]=\"textClass\">\n <mat-icon class=\"cqa-text-[18px] cqa-leading-[18px] cqa-w-[18px] cqa-h-[18px]\">\n {{ icon }}\n </mat-icon>\n </span>\n <span [class]=\"labelClasses\" [ngClass]=\"textClass\">\n <ng-content></ng-content>\n </span>\n <span *ngIf=\"icon && iconPosition === 'end'\" [class]=\"iconClasses\" [ngClass]=\"textClass\">\n <mat-icon class=\"cqa-text-[18px] cqa-leading-[18px] cqa-w-[18px] cqa-h-[18px]\">\n {{ icon }}\n </mat-icon>\n </span>\n </span>\n </button>\n</div>\n\n", styles: [] }]
238
- }], propDecorators: { variant: [{
239
- type: Input
240
- }], disabled: [{
241
- type: Input
242
- }], icon: [{
243
- type: Input
244
- }], iconPosition: [{
245
- type: Input
246
- }], type: [{
247
- type: Input
248
- }], clicked: [{
249
- type: Output
250
- }], onMouseEnter: [{
251
- type: HostListener,
252
- args: ['mouseenter']
253
- }], onMouseLeave: [{
254
- type: HostListener,
255
- args: ['mouseleave']
256
- }], onMouseDown: [{
257
- type: HostListener,
258
- args: ['mousedown']
259
- }], onMouseUp: [{
260
- type: HostListener,
261
- args: ['mouseup']
262
- }], onFocus: [{
263
- type: HostListener,
264
- args: ['focus']
265
- }], onBlur: [{
266
- type: HostListener,
267
- args: ['blur']
268
- }] } });
269
-
270
- class SearchBarComponent {
271
- constructor() {
272
- /** Placeholder text for the input */
273
- this.placeholder = 'Search';
274
- /** Initial value or externally controlled value */
275
- this.value = '';
276
- /** Disable interactions */
277
- this.disabled = false;
278
- /** Whether the clear button should be visible when there is text */
279
- this.showClear = true;
280
- /** Accessible label for the input */
281
- this.ariaLabel = 'Search';
282
- /** Automatically focus the input when rendered */
283
- this.autoFocus = false;
284
- /** Search bar size */
285
- this.size = 'md';
286
- /** Stretch to fill container width */
287
- this.fullWidth = false;
288
- /** Emit on value changes (e.g. for two-way binding) */
289
- this.valueChange = new EventEmitter();
290
- /** Emit when user submits search (Enter key or form submit) */
291
- this.search = new EventEmitter();
292
- /** Emit when the value is cleared via the clear button */
293
- this.cleared = new EventEmitter();
294
- this.inputValue = '';
295
- this.widthClasses = {
296
- sm: 'cqa-w-[295px]',
297
- md: 'cqa-w-[395px]',
298
- lg: 'cqa-w-[495px]',
299
- };
300
- }
301
- ngOnChanges(changes) {
302
- var _a;
303
- if (changes['value'] && changes['value'].currentValue !== undefined) {
304
- const newValue = (_a = changes['value'].currentValue) !== null && _a !== void 0 ? _a : '';
305
- if (newValue !== this.inputValue) {
306
- this.inputValue = newValue;
307
- }
308
- }
309
- }
310
- onInput(event) {
311
- var _a;
312
- const target = event.target;
313
- const nextValue = (_a = target === null || target === void 0 ? void 0 : target.value) !== null && _a !== void 0 ? _a : '';
314
- this.inputValue = nextValue;
315
- this.valueChange.emit(this.inputValue);
316
- }
317
- onSubmit(event) {
318
- event.preventDefault();
319
- if (this.disabled) {
320
- return;
321
- }
322
- this.search.emit(this.inputValue.trim());
323
- }
324
- clear() {
325
- if (this.disabled || this.inputValue === '') {
326
- return;
327
- }
328
- this.inputValue = '';
329
- this.valueChange.emit('');
330
- this.cleared.emit();
331
- }
332
- }
333
- SearchBarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: SearchBarComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
334
- SearchBarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.4.0", type: SearchBarComponent, selector: "cqa-search-bar", inputs: { placeholder: "placeholder", value: "value", disabled: "disabled", showClear: "showClear", ariaLabel: "ariaLabel", autoFocus: "autoFocus", size: "size", fullWidth: "fullWidth" }, outputs: { valueChange: "valueChange", search: "search", cleared: "cleared" }, usesOnChanges: true, ngImport: i0, template: "<div id=\"cqa-ui-root\" [style.display]=\"fullWidth ? 'block' : 'inline-block'\" [style.width]=\"fullWidth ? '100%' : 'auto'\">\n <form\n class=\"cqa-inline-flex cqa-items-center cqa-gap-2 cqa-px-6 cqa-py-3 cqa-text-[14px] cqa-border cqa-border-gray-200 cqa-rounded-md cqa-bg-white cqa-shadow-sm cqa-transition-colors\"\n [ngClass]=\"fullWidth ? 'cqa-w-full' : widthClasses[size]\"\n (submit)=\"onSubmit($event)\"\n >\n <span\n class=\"cqa-flex-none cqa-flex cqa-items-center cqa-justify-center cqa-text-gray-400 cqa-w-4 cqa-h-4\"\n [ngClass]=\"{ 'cqa-opacity-[0.38]': disabled }\"\n >\n <mat-icon\n class=\"cqa-flex cqa-items-center cqa-justify-center cqa-leading-none cqa-p-0\"\n [style.width.px]=\"16\"\n [style.height.px]=\"16\"\n [style.fontSize.px]=\"16\"\n >\n search\n </mat-icon>\n </span>\n\n <input\n type=\"text\"\n class=\"cqa-flex-1 cqa-min-w-[180px] cqa-border-none cqa-outline-none cqa-bg-transparent placeholder:cqa-text-gray-400 disabled:cqa-text-gray-400 disabled:cqa-cursor-not-allowed cqa-font-['SF_Pro_Text'] cqa-font-normal cqa-text-[12.3px] cqa-leading-none cqa-tracking-normal cqa-align-middle cqa-text-[#99999E]\"\n style=\"font-family: 'SF Pro Text', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; letter-spacing: 0;\"\n [placeholder]=\"placeholder\"\n [value]=\"inputValue\"\n (input)=\"onInput($event)\"\n [disabled]=\"disabled\"\n [attr.aria-label]=\"ariaLabel\"\n autocomplete=\"off\"\n autocapitalize=\"none\"\n spellcheck=\"false\"\n [attr.autofocus]=\"autoFocus ? '' : null\"\n />\n\n <button\n *ngIf=\"showClear && inputValue\"\n type=\"button\"\n class=\"cqa-flex cqa-items-center cqa-justify-center cqa-p-0 cqa-w-4 cqa-h-4 cqa-border-0 cqa-bg-transparent cqa-cursor-pointer cqa-text-gray-500 cqa-hover:cqa-text-gray-700 disabled:cqa-text-gray-300 cqa-transition-colors cqa-leading-none\"\n (click)=\"clear()\"\n [disabled]=\"disabled\"\n aria-label=\"Clear search\"\n >\n <mat-icon\n class=\"cqa-flex cqa-items-center cqa-justify-center cqa-leading-none cqa-p-0\"\n [style.width.px]=\"16\"\n [style.height.px]=\"16\"\n [style.fontSize.px]=\"16\"\n [ngClass]=\"{ 'cqa-opacity-[0.38]': disabled }\"\n >\n close\n </mat-icon>\n </button>\n </form>\n</div>\n", components: [{ type: i1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }], directives: [{ type: i2$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { type: i2$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i2$1.NgForm, selector: "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
335
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: SearchBarComponent, decorators: [{
336
- type: Component,
337
- args: [{ selector: 'cqa-search-bar', template: "<div id=\"cqa-ui-root\" [style.display]=\"fullWidth ? 'block' : 'inline-block'\" [style.width]=\"fullWidth ? '100%' : 'auto'\">\n <form\n class=\"cqa-inline-flex cqa-items-center cqa-gap-2 cqa-px-6 cqa-py-3 cqa-text-[14px] cqa-border cqa-border-gray-200 cqa-rounded-md cqa-bg-white cqa-shadow-sm cqa-transition-colors\"\n [ngClass]=\"fullWidth ? 'cqa-w-full' : widthClasses[size]\"\n (submit)=\"onSubmit($event)\"\n >\n <span\n class=\"cqa-flex-none cqa-flex cqa-items-center cqa-justify-center cqa-text-gray-400 cqa-w-4 cqa-h-4\"\n [ngClass]=\"{ 'cqa-opacity-[0.38]': disabled }\"\n >\n <mat-icon\n class=\"cqa-flex cqa-items-center cqa-justify-center cqa-leading-none cqa-p-0\"\n [style.width.px]=\"16\"\n [style.height.px]=\"16\"\n [style.fontSize.px]=\"16\"\n >\n search\n </mat-icon>\n </span>\n\n <input\n type=\"text\"\n class=\"cqa-flex-1 cqa-min-w-[180px] cqa-border-none cqa-outline-none cqa-bg-transparent placeholder:cqa-text-gray-400 disabled:cqa-text-gray-400 disabled:cqa-cursor-not-allowed cqa-font-['SF_Pro_Text'] cqa-font-normal cqa-text-[12.3px] cqa-leading-none cqa-tracking-normal cqa-align-middle cqa-text-[#99999E]\"\n style=\"font-family: 'SF Pro Text', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; letter-spacing: 0;\"\n [placeholder]=\"placeholder\"\n [value]=\"inputValue\"\n (input)=\"onInput($event)\"\n [disabled]=\"disabled\"\n [attr.aria-label]=\"ariaLabel\"\n autocomplete=\"off\"\n autocapitalize=\"none\"\n spellcheck=\"false\"\n [attr.autofocus]=\"autoFocus ? '' : null\"\n />\n\n <button\n *ngIf=\"showClear && inputValue\"\n type=\"button\"\n class=\"cqa-flex cqa-items-center cqa-justify-center cqa-p-0 cqa-w-4 cqa-h-4 cqa-border-0 cqa-bg-transparent cqa-cursor-pointer cqa-text-gray-500 cqa-hover:cqa-text-gray-700 disabled:cqa-text-gray-300 cqa-transition-colors cqa-leading-none\"\n (click)=\"clear()\"\n [disabled]=\"disabled\"\n aria-label=\"Clear search\"\n >\n <mat-icon\n class=\"cqa-flex cqa-items-center cqa-justify-center cqa-leading-none cqa-p-0\"\n [style.width.px]=\"16\"\n [style.height.px]=\"16\"\n [style.fontSize.px]=\"16\"\n [ngClass]=\"{ 'cqa-opacity-[0.38]': disabled }\"\n >\n close\n </mat-icon>\n </button>\n </form>\n</div>\n", styles: [] }]
338
- }], propDecorators: { placeholder: [{
339
- type: Input
340
- }], value: [{
341
- type: Input
342
- }], disabled: [{
343
- type: Input
344
- }], showClear: [{
345
- type: Input
346
- }], ariaLabel: [{
347
- type: Input
348
- }], autoFocus: [{
349
- type: Input
350
- }], size: [{
351
- type: Input
352
- }], fullWidth: [{
353
- type: Input
354
- }], valueChange: [{
355
- type: Output
356
- }], search: [{
357
- type: Output
358
- }], cleared: [{
359
- type: Output
360
- }] } });
361
-
362
- class SegmentControlComponent {
363
- constructor() {
364
- this.segments = [
365
- { label: 'Tab Group', value: 'tab-group-1' },
366
- { label: 'Tab Group', value: 'tab-group-2' },
367
- ];
368
- this.disabled = false;
369
- this.valueChange = new EventEmitter();
370
- this.indicatorStyle = {};
371
- this.indicatorVisible = false;
372
- }
373
- ngOnChanges(changes) {
374
- if (changes['segments'] || changes['value']) {
375
- this.ensureSelectedValue();
376
- }
377
- }
378
- ngAfterViewInit() {
379
- this.buttonChangesSub = this.segmentButtons.changes.subscribe(() => this.updateIndicator());
380
- this.ensureSelectedValue();
381
- this.updateIndicator();
382
- }
383
- ngOnDestroy() {
384
- var _a, _b;
385
- (_b = (_a = this.buttonChangesSub) === null || _a === void 0 ? void 0 : _a.unsubscribe) === null || _b === void 0 ? void 0 : _b.call(_a);
386
- }
387
- trackByValue(_index, option) {
388
- return option.value;
389
- }
390
- isSelected(option) {
391
- return option.value === this.value;
392
- }
393
- select(option, index) {
394
- if (this.disabled || option.disabled) {
395
- return;
396
- }
397
- const nextValue = option.value;
398
- if (nextValue !== this.value) {
399
- this.value = nextValue;
400
- this.valueChange.emit(nextValue);
401
- }
402
- this.focusButton(index);
403
- this.updateIndicator();
404
- }
405
- onKeyDown(event, currentIndex) {
406
- if (this.disabled) {
407
- return;
408
- }
409
- switch (event.key) {
410
- case 'ArrowRight':
411
- case 'ArrowDown':
412
- event.preventDefault();
413
- this.moveSelection(1, currentIndex);
414
- break;
415
- case 'ArrowLeft':
416
- case 'ArrowUp':
417
- event.preventDefault();
418
- this.moveSelection(-1, currentIndex);
419
- break;
420
- case 'Home':
421
- event.preventDefault();
422
- this.selectFirstEnabled();
423
- break;
424
- case 'End':
425
- event.preventDefault();
426
- this.selectLastEnabled();
427
- break;
428
- case ' ':
429
- case 'Enter':
430
- event.preventDefault();
431
- this.select(this.segments[currentIndex], currentIndex);
432
- break;
433
- default:
434
- break;
435
- }
436
- }
437
- moveSelection(step, startIndex) {
438
- const enabledIndexes = this.getEnabledIndexes();
439
- if (enabledIndexes.length === 0) {
440
- return;
441
- }
442
- const currentEnabledIndex = enabledIndexes.indexOf(startIndex);
443
- const fallbackIndex = this.getSelectedIndex(enabledIndexes);
444
- const baseIndex = currentEnabledIndex >= 0 ? currentEnabledIndex : fallbackIndex;
445
- const nextPosition = (baseIndex + step + enabledIndexes.length) % enabledIndexes.length;
446
- const targetIndex = enabledIndexes[nextPosition];
447
- this.select(this.segments[targetIndex], targetIndex);
448
- }
449
- selectFirstEnabled() {
450
- const enabledIndexes = this.getEnabledIndexes();
451
- if (enabledIndexes.length > 0) {
452
- const index = enabledIndexes[0];
453
- this.select(this.segments[index], index);
454
- this.updateIndicator();
455
- }
456
- }
457
- selectLastEnabled() {
458
- const enabledIndexes = this.getEnabledIndexes();
459
- if (enabledIndexes.length > 0) {
460
- const index = enabledIndexes[enabledIndexes.length - 1];
461
- this.select(this.segments[index], index);
462
- this.updateIndicator();
463
- }
464
- }
465
- getEnabledIndexes() {
466
- return this.segments
467
- .map((option, index) => ({ option, index }))
468
- .filter(({ option }) => !option.disabled)
469
- .map(({ index }) => index);
470
- }
471
- getSelectedIndex(enabledIndexes) {
472
- const current = this.segments.findIndex((option) => option.value === this.value && !option.disabled);
473
- if (current >= 0) {
474
- return enabledIndexes.indexOf(current);
475
- }
476
- return 0;
477
- }
478
- ensureSelectedValue() {
479
- const enabled = this.segments.filter((option) => !option.disabled);
480
- if (enabled.length === 0) {
481
- this.value = undefined;
482
- return;
483
- }
484
- if (!this.value || !this.segments.some((option) => option.value === this.value)) {
485
- this.value = enabled[0].value;
486
- this.valueChange.emit(this.value);
487
- const index = this.segments.indexOf(enabled[0]);
488
- this.focusButton(index);
489
- this.updateIndicator(index);
490
- return;
491
- }
492
- const selected = this.segments.find((option) => option.value === this.value);
493
- if (selected === null || selected === void 0 ? void 0 : selected.disabled) {
494
- this.value = enabled[0].value;
495
- this.valueChange.emit(this.value);
496
- const index = this.segments.indexOf(enabled[0]);
497
- this.focusButton(index);
498
- this.updateIndicator(index);
499
- }
500
- this.updateIndicator();
501
- }
502
- focusButton(index) {
503
- queueMicrotask(() => {
504
- var _a, _b;
505
- const button = (_b = (_a = this.segmentButtons) === null || _a === void 0 ? void 0 : _a.get(index)) === null || _b === void 0 ? void 0 : _b.nativeElement;
506
- button === null || button === void 0 ? void 0 : button.focus();
507
- });
508
- }
509
- updateIndicator(preferredIndex) {
510
- queueMicrotask(() => {
511
- var _a, _b, _c, _d, _e;
512
- const container = (_a = this.segmentContainer) === null || _a === void 0 ? void 0 : _a.nativeElement;
513
- const buttons = (_c = (_b = this.segmentButtons) === null || _b === void 0 ? void 0 : _b.toArray()) !== null && _c !== void 0 ? _c : [];
514
- if (!container || buttons.length === 0) {
515
- this.indicatorVisible = false;
516
- this.indicatorStyle = {};
517
- return;
518
- }
519
- const index = preferredIndex !== null && preferredIndex !== void 0 ? preferredIndex : buttons.findIndex((button, idx) => { var _a; return ((_a = this.segments[idx]) === null || _a === void 0 ? void 0 : _a.value) === this.value; });
520
- if (index === -1) {
521
- this.indicatorVisible = false;
522
- this.indicatorStyle = {};
523
- return;
524
- }
525
- const buttonEl = (_d = buttons[index]) === null || _d === void 0 ? void 0 : _d.nativeElement;
526
- if (!buttonEl) {
527
- this.indicatorVisible = false;
528
- this.indicatorStyle = {};
529
- return;
530
- }
531
- const containerRect = container.getBoundingClientRect();
532
- const buttonRect = buttonEl.getBoundingClientRect();
533
- const offsetLeft = buttonEl.offsetLeft;
534
- const offsetTop = buttonEl.offsetTop;
535
- const width = buttonEl.offsetWidth;
536
- const height = buttonEl.offsetHeight;
537
- const isDisabled = this.disabled || ((_e = this.segments[index]) === null || _e === void 0 ? void 0 : _e.disabled);
538
- this.indicatorStyle = {
539
- width: `${width}px`,
540
- height: `${height}px`,
541
- left: `${offsetLeft}px`,
542
- top: `${offsetTop}px`,
543
- backgroundColor: isDisabled ? '#9BA0F4' : '#3F43EE',
544
- };
545
- this.indicatorVisible = true;
546
- });
547
- }
548
- get isIndicatorVisible() {
549
- return this.indicatorVisible;
550
- }
551
- }
552
- SegmentControlComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: SegmentControlComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
553
- SegmentControlComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.4.0", type: SegmentControlComponent, selector: "cqa-segment-control", inputs: { segments: "segments", value: "value", disabled: "disabled" }, outputs: { valueChange: "valueChange" }, viewQueries: [{ propertyName: "segmentContainer", first: true, predicate: ["segmentContainer"], descendants: true }, { propertyName: "segmentButtons", predicate: ["segmentButton"], descendants: true }], usesOnChanges: true, ngImport: i0, template: "<div id=\"cqa-ui-root\" style=\"display: inline-block;\">\n <div\n #segmentContainer\n class=\"cqa-relative cqa-inline-flex cqa-flex-row cqa-items-start cqa-p-[3.5px] cqa-h-[31.5px] cqa-bg-[#F5F5F5] cqa-rounded-[8px]\"\n role=\"tablist\"\n [attr.aria-disabled]=\"disabled || null\"\n >\n <div\n class=\"cqa-absolute cqa-rounded-[8px] cqa-transition-all cqa-duration-200 cqa-ease-in-out cqa-pointer-events-none\"\n [class.cqa-opacity-0]=\"!isIndicatorVisible\"\n [ngStyle]=\"indicatorStyle\"\n aria-hidden=\"true\"\n ></div>\n\n <button\n *ngFor=\"let segment of segments; index as index; trackBy: trackByValue\"\n #segmentButton\n type=\"button\"\n role=\"tab\"\n class=\"cqa-relative cqa-z-10 cqa-flex cqa-flex-col cqa-justify-center cqa-items-center cqa-px-[14px] cqa-py-[3.5px] cqa-h-[25px] cqa-rounded-[8px] cqa-transition-all cqa-duration-200 cqa-ease-in-out cqa-whitespace-nowrap cqa-text-center focus:cqa-outline-none focus-visible:cqa-outline-none focus-visible:cqa-ring-0 focus-visible:cqa-ring-offset-0 cqa-flex-none\"\n [ngClass]=\"{\n 'cqa-text-white cqa-font-medium': isSelected(segment),\n 'cqa-text-[#99999E]': !isSelected(segment) && !(disabled || segment.disabled),\n 'cqa-cursor-not-allowed': disabled || segment.disabled,\n 'cqa-text-[#C7C7C7]': (disabled || segment.disabled) && !isSelected(segment),\n 'cqa-hover:cqa-text-black': !isSelected(segment) && !disabled && !segment.disabled\n }\"\n [disabled]=\"disabled || segment.disabled\"\n [attr.aria-selected]=\"isSelected(segment)\"\n [attr.tabindex]=\"!disabled && !segment.disabled ? (isSelected(segment) ? 0 : -1) : -1\"\n (click)=\"select(segment, index)\"\n (keydown)=\"onKeyDown($event, index)\"\n >\n <span class=\"cqa-flex cqa-items-center cqa-justify-center cqa-h-[18px] cqa-font-['Inter'] cqa-font-normal cqa-text-[12px] cqa-leading-[12px] cqa-text-center cqa-align-middle\">\n {{ segment.label }}\n </span>\n </button>\n </div>\n</div>\n", directives: [{ type: i2.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] });
554
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: SegmentControlComponent, decorators: [{
555
- type: Component,
556
- args: [{ selector: 'cqa-segment-control', template: "<div id=\"cqa-ui-root\" style=\"display: inline-block;\">\n <div\n #segmentContainer\n class=\"cqa-relative cqa-inline-flex cqa-flex-row cqa-items-start cqa-p-[3.5px] cqa-h-[31.5px] cqa-bg-[#F5F5F5] cqa-rounded-[8px]\"\n role=\"tablist\"\n [attr.aria-disabled]=\"disabled || null\"\n >\n <div\n class=\"cqa-absolute cqa-rounded-[8px] cqa-transition-all cqa-duration-200 cqa-ease-in-out cqa-pointer-events-none\"\n [class.cqa-opacity-0]=\"!isIndicatorVisible\"\n [ngStyle]=\"indicatorStyle\"\n aria-hidden=\"true\"\n ></div>\n\n <button\n *ngFor=\"let segment of segments; index as index; trackBy: trackByValue\"\n #segmentButton\n type=\"button\"\n role=\"tab\"\n class=\"cqa-relative cqa-z-10 cqa-flex cqa-flex-col cqa-justify-center cqa-items-center cqa-px-[14px] cqa-py-[3.5px] cqa-h-[25px] cqa-rounded-[8px] cqa-transition-all cqa-duration-200 cqa-ease-in-out cqa-whitespace-nowrap cqa-text-center focus:cqa-outline-none focus-visible:cqa-outline-none focus-visible:cqa-ring-0 focus-visible:cqa-ring-offset-0 cqa-flex-none\"\n [ngClass]=\"{\n 'cqa-text-white cqa-font-medium': isSelected(segment),\n 'cqa-text-[#99999E]': !isSelected(segment) && !(disabled || segment.disabled),\n 'cqa-cursor-not-allowed': disabled || segment.disabled,\n 'cqa-text-[#C7C7C7]': (disabled || segment.disabled) && !isSelected(segment),\n 'cqa-hover:cqa-text-black': !isSelected(segment) && !disabled && !segment.disabled\n }\"\n [disabled]=\"disabled || segment.disabled\"\n [attr.aria-selected]=\"isSelected(segment)\"\n [attr.tabindex]=\"!disabled && !segment.disabled ? (isSelected(segment) ? 0 : -1) : -1\"\n (click)=\"select(segment, index)\"\n (keydown)=\"onKeyDown($event, index)\"\n >\n <span class=\"cqa-flex cqa-items-center cqa-justify-center cqa-h-[18px] cqa-font-['Inter'] cqa-font-normal cqa-text-[12px] cqa-leading-[12px] cqa-text-center cqa-align-middle\">\n {{ segment.label }}\n </span>\n </button>\n </div>\n</div>\n", styles: [] }]
557
- }], propDecorators: { segments: [{
558
- type: Input
559
- }], value: [{
560
- type: Input
561
- }], disabled: [{
562
- type: Input
563
- }], valueChange: [{
564
- type: Output
565
- }], segmentButtons: [{
566
- type: ViewChildren,
567
- args: ['segmentButton']
568
- }], segmentContainer: [{
569
- type: ViewChild,
570
- args: ['segmentContainer']
571
- }] } });
572
-
573
- class DialogComponent {
574
- constructor(viewContainerRef, cdr) {
575
- this.viewContainerRef = viewContainerRef;
576
- this.cdr = cdr;
577
- this.contentAttached = false;
578
- }
579
- attachTemplate(template, context) {
580
- var _a, _b;
581
- if (!this.portalOutlet) {
582
- return;
583
- }
584
- const templateContext = context !== null && context !== void 0 ? context : {
585
- $implicit: (_a = this.config) === null || _a === void 0 ? void 0 : _a.data,
586
- data: (_b = this.config) === null || _b === void 0 ? void 0 : _b.data,
587
- };
588
- const portal = new TemplatePortal(template, this.viewContainerRef, templateContext);
589
- this.portalOutlet.attachTemplatePortal(portal);
590
- this.markContentAttached();
591
- }
592
- attachComponent(component) {
593
- if (!this.portalOutlet) {
594
- return undefined;
595
- }
596
- const componentRef = this.portalOutlet.attachComponentPortal(component);
597
- this.markContentAttached();
598
- return componentRef;
599
- }
600
- onButtonClick(button) {
601
- var _a;
602
- return __awaiter(this, void 0, void 0, function* () {
603
- const closeOnClick = (_a = button.closeOnClick) !== null && _a !== void 0 ? _a : true;
604
- let handlerResult = undefined;
605
- if (button.handler) {
606
- handlerResult = button.handler(this.dialogRef);
607
- }
608
- const resolved = handlerResult instanceof Promise ? yield handlerResult : handlerResult;
609
- if (!closeOnClick || resolved === false) {
610
- return;
611
- }
612
- this.dialogRef.close(resolved);
613
- });
614
- }
615
- get buttonAlignmentClass() {
616
- var _a, _b;
617
- const alignment = (_b = (_a = this.config) === null || _a === void 0 ? void 0 : _a.buttonAlignment) !== null && _b !== void 0 ? _b : 'right';
618
- return this.mapAlignmentToClass(alignment);
619
- }
620
- get panelClassList() {
621
- var _a;
622
- const baseClasses = [
623
- 'cqa-relative',
624
- 'cqa-w-full',
625
- 'cqa-bg-white',
626
- 'cqa-rounded-2xl',
627
- 'cqa-shadow-md',
628
- 'cqa-border',
629
- 'cqa-border-[#E5E7EB]',
630
- 'cqa-p-6',
631
- 'cqa-text-left',
632
- ];
633
- const custom = (_a = this.config) === null || _a === void 0 ? void 0 : _a.panelClass;
634
- if (!custom) {
635
- return baseClasses;
636
- }
637
- return Array.isArray(custom) ? [...baseClasses, ...custom] : [...baseClasses, custom];
638
- }
639
- get panelStyles() {
640
- var _a, _b, _c;
641
- return {
642
- width: (_a = this.config) === null || _a === void 0 ? void 0 : _a.width,
643
- maxWidth: (_c = (_b = this.config) === null || _b === void 0 ? void 0 : _b.maxWidth) !== null && _c !== void 0 ? _c : '480px',
644
- };
645
- }
646
- buttonVariant(button) {
647
- const role = this.normalizeRole(button.role);
648
- switch (role) {
649
- case 'secondary':
650
- return 'outlined';
651
- case 'text':
652
- return 'text';
653
- case 'tonal':
654
- return 'tonal';
655
- case 'elevated':
656
- return 'elevated';
657
- case 'filled':
658
- case 'primary':
659
- case 'warn':
660
- default:
661
- return 'filled';
662
- }
663
- }
664
- buttonHostClasses(button) {
665
- const role = this.normalizeRole(button.role);
666
- if (role === 'warn') {
667
- return ['cqa-dialog-btn-warn'];
668
- }
669
- return [];
670
- }
671
- mapAlignmentToClass(alignment) {
672
- switch (alignment) {
673
- case 'left':
674
- return 'cqa-justify-start';
675
- case 'center':
676
- return 'cqa-justify-center';
677
- case 'right':
678
- default:
679
- return 'cqa-justify-end';
680
- }
681
- }
682
- markContentAttached() {
683
- this.contentAttached = true;
684
- this.cdr.markForCheck();
685
- }
686
- normalizeRole(role) {
687
- return (role !== null && role !== void 0 ? role : 'secondary').trim().split(/\s+/)[0];
688
- }
689
- }
690
- DialogComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: DialogComponent, deps: [{ token: i0.ViewContainerRef }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
691
- DialogComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.4.0", type: DialogComponent, selector: "cqa-dialog", viewQueries: [{ propertyName: "portalOutlet", first: true, predicate: CdkPortalOutlet, descendants: true, static: true }], ngImport: i0, template: "<div id=\"cqa-ui-root\" style=\"display: block;\">\n <div class=\"cqa-flex cqa-w-full cqa-justify-center cqa-px-4 sm:cqa-px-6\">\n <div [ngClass]=\"panelClassList\" [ngStyle]=\"panelStyles\">\n <div class=\"cqa-flex cqa-flex-col cqa-gap-5\">\n <div class=\"cqa-flex cqa-flex-col cqa-gap-3\">\n <h2 class=\"cqa-text-lg cqa-font-semibold cqa-text-[#111827]\">\n {{ config.title }}\n </h2>\n\n <p *ngIf=\"config.description\" class=\"cqa-text-sm cqa-leading-6 cqa-text-[#4B5563]\">\n {{ config.description }}\n </p>\n\n <div\n *ngIf=\"config.warning\"\n class=\"cqa-rounded-xl cqa-border cqa-border-red-200 cqa-bg-red-50 cqa-px-4 cqa-py-3 cqa-text-sm cqa-leading-5 cqa-text-red-700\"\n >\n {{ config.warning }}\n </div>\n </div>\n\n <div class=\"cqa-text-sm cqa-text-[#111827]\" [class.hidden]=\"!contentAttached\">\n <ng-template cdkPortalOutlet></ng-template>\n </div>\n\n <div class=\"cqa-mt-4 cqa-flex cqa-flex-wrap cqa-gap-3\" [ngClass]=\"buttonAlignmentClass\">\n <cqa-button\n *ngFor=\"let button of config.buttons\"\n type=\"button\"\n [variant]=\"buttonVariant(button)\"\n [ngClass]=\"buttonHostClasses(button)\"\n (clicked)=\"onButtonClick(button)\"\n >\n {{ button.label }}\n </cqa-button>\n </div>\n </div>\n </div>\n </div>\n</div>\n\n\n", components: [{ type: ButtonComponent, selector: "cqa-button", inputs: ["variant", "disabled", "icon", "iconPosition", "type"], outputs: ["clicked"] }], directives: [{ type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i2.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i3.CdkPortalOutlet, selector: "[cdkPortalOutlet]", inputs: ["cdkPortalOutlet"], outputs: ["attached"], exportAs: ["cdkPortalOutlet"] }, { type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
692
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: DialogComponent, decorators: [{
693
- type: Component,
694
- args: [{ selector: 'cqa-dialog', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div id=\"cqa-ui-root\" style=\"display: block;\">\n <div class=\"cqa-flex cqa-w-full cqa-justify-center cqa-px-4 sm:cqa-px-6\">\n <div [ngClass]=\"panelClassList\" [ngStyle]=\"panelStyles\">\n <div class=\"cqa-flex cqa-flex-col cqa-gap-5\">\n <div class=\"cqa-flex cqa-flex-col cqa-gap-3\">\n <h2 class=\"cqa-text-lg cqa-font-semibold cqa-text-[#111827]\">\n {{ config.title }}\n </h2>\n\n <p *ngIf=\"config.description\" class=\"cqa-text-sm cqa-leading-6 cqa-text-[#4B5563]\">\n {{ config.description }}\n </p>\n\n <div\n *ngIf=\"config.warning\"\n class=\"cqa-rounded-xl cqa-border cqa-border-red-200 cqa-bg-red-50 cqa-px-4 cqa-py-3 cqa-text-sm cqa-leading-5 cqa-text-red-700\"\n >\n {{ config.warning }}\n </div>\n </div>\n\n <div class=\"cqa-text-sm cqa-text-[#111827]\" [class.hidden]=\"!contentAttached\">\n <ng-template cdkPortalOutlet></ng-template>\n </div>\n\n <div class=\"cqa-mt-4 cqa-flex cqa-flex-wrap cqa-gap-3\" [ngClass]=\"buttonAlignmentClass\">\n <cqa-button\n *ngFor=\"let button of config.buttons\"\n type=\"button\"\n [variant]=\"buttonVariant(button)\"\n [ngClass]=\"buttonHostClasses(button)\"\n (clicked)=\"onButtonClick(button)\"\n >\n {{ button.label }}\n </cqa-button>\n </div>\n </div>\n </div>\n </div>\n</div>\n\n\n", styles: [] }]
695
- }], ctorParameters: function () { return [{ type: i0.ViewContainerRef }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { portalOutlet: [{
696
- type: ViewChild,
697
- args: [CdkPortalOutlet, { static: true }]
698
- }] } });
699
-
700
- // import { RootWrapperComponent } from './root-wrapper/root-wrapper.component';
701
- // import { CardComponent } from './card/card.component';
702
- // import { InputComponent } from './input/input.component';
703
- // import { IconButtonComponent } from './icon-button/icon-button.component';
704
- class UiKitModule {
705
- }
706
- UiKitModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: UiKitModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
707
- UiKitModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: UiKitModule, declarations: [ButtonComponent,
708
- SearchBarComponent,
709
- SegmentControlComponent,
710
- DialogComponent], imports: [CommonModule,
711
- FormsModule,
712
- MatIconModule,
713
- OverlayModule,
714
- PortalModule], exports: [ButtonComponent,
715
- SearchBarComponent,
716
- SegmentControlComponent,
717
- DialogComponent] });
718
- UiKitModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: UiKitModule, imports: [[
719
- CommonModule,
720
- FormsModule,
721
- MatIconModule,
722
- OverlayModule,
723
- PortalModule
724
- ]] });
725
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: UiKitModule, decorators: [{
726
- type: NgModule,
727
- args: [{
728
- declarations: [
729
- ButtonComponent,
730
- SearchBarComponent,
731
- SegmentControlComponent,
732
- DialogComponent,
733
- // RootWrapperComponent,
734
- // CardComponent,
735
- // InputComponent,
736
- // IconButtonComponent
737
- ],
738
- imports: [
739
- CommonModule,
740
- FormsModule,
741
- MatIconModule,
742
- OverlayModule,
743
- PortalModule
744
- ],
745
- exports: [
746
- ButtonComponent,
747
- SearchBarComponent,
748
- SegmentControlComponent,
749
- DialogComponent,
750
- // RootWrapperComponent,
751
- // CardComponent,
752
- // InputComponent,
753
- // IconButtonComponent
754
- ]
755
- }]
756
- }] });
757
-
758
- class DialogRef {
759
- constructor(overlayRef) {
760
- this.overlayRef = overlayRef;
761
- this.closed$ = new Subject();
762
- this.isClosed = false;
763
- this.overlayRef.detachments().subscribe(() => {
764
- this.finishClose(undefined);
765
- });
766
- }
767
- close(result) {
768
- if (this.isClosed) {
769
- return;
770
- }
771
- this.finishClose(result);
772
- this.overlayRef.dispose();
773
- }
774
- afterClosed() {
775
- return this.closed$.asObservable();
776
- }
777
- setComponentInstance(instance) {
778
- this.componentInstance = instance;
779
- }
780
- getComponentInstance() {
781
- return this.componentInstance;
782
- }
783
- finishClose(result) {
784
- if (this.isClosed) {
785
- return;
786
- }
787
- this.isClosed = true;
788
- this.closed$.next(result);
789
- this.closed$.complete();
790
- }
791
- }
792
-
793
- const DIALOG_REF = new InjectionToken('CQA_DIALOG_REF');
794
- const DIALOG_DATA = new InjectionToken('CQA_DIALOG_DATA');
795
-
796
- class DialogService {
797
- constructor(overlay, injector) {
798
- this.overlay = overlay;
799
- this.injector = injector;
800
- }
801
- open(config) {
802
- var _a, _b, _c;
803
- this.assertValidConfig(config);
804
- const overlayRef = this.overlay.create(this.buildOverlayConfig(config));
805
- const dialogRef = new DialogRef(overlayRef);
806
- const injector = Injector.create({
807
- parent: this.injector,
808
- providers: [
809
- { provide: DIALOG_REF, useValue: dialogRef },
810
- { provide: DIALOG_DATA, useValue: config.data },
811
- ],
812
- });
813
- const containerPortal = new ComponentPortal(DialogComponent, undefined, injector);
814
- const containerRef = overlayRef.attach(containerPortal);
815
- const containerInstance = containerRef.instance;
816
- containerInstance.config = config;
817
- containerInstance.dialogRef = dialogRef;
818
- if (((_a = config.content) === null || _a === void 0 ? void 0 : _a.type) === 'template') {
819
- containerInstance.attachTemplate(config.content.template, (_b = config.content.context) !== null && _b !== void 0 ? _b : {
820
- $implicit: config.data,
821
- data: config.data,
822
- });
823
- }
824
- if (((_c = config.content) === null || _c === void 0 ? void 0 : _c.type) === 'component') {
825
- const componentPortal = new ComponentPortal(config.content.component, undefined, Injector.create({
826
- parent: injector,
827
- providers: [
828
- { provide: DIALOG_REF, useValue: dialogRef },
829
- { provide: DIALOG_DATA, useValue: config.data },
830
- ],
831
- }));
832
- const componentRef = containerInstance.attachComponent(componentPortal);
833
- if (componentRef && config.content.inputs) {
834
- Object.entries(config.content.inputs).forEach(([key, value]) => {
835
- componentRef.instance[key] = value;
836
- });
837
- componentRef.changeDetectorRef.markForCheck();
838
- }
839
- if (componentRef) {
840
- dialogRef.setComponentInstance(componentRef.instance);
841
- }
842
- }
843
- containerRef.changeDetectorRef.markForCheck();
844
- if (!config.disableClose) {
845
- overlayRef.backdropClick().subscribe(() => dialogRef.close());
846
- overlayRef
847
- .keydownEvents()
848
- .pipe(filter((event) => {
849
- return event.key === 'Escape' || event.key === 'Esc';
850
- }))
851
- .subscribe(() => dialogRef.close());
852
- }
853
- return dialogRef;
854
- }
855
- assertValidConfig(config) {
856
- if (!config.title) {
857
- throw new Error('Dialog title is required.');
858
- }
859
- if (!config.buttons || config.buttons.length < 2) {
860
- throw new Error('Dialog requires at least two buttons to be provided.');
861
- }
862
- }
863
- buildOverlayConfig(config) {
864
- var _a;
865
- const panelClass = Array.isArray(config.panelClass)
866
- ? config.panelClass
867
- : config.panelClass
868
- ? [config.panelClass]
869
- : [];
870
- return new OverlayConfig({
871
- hasBackdrop: true,
872
- backdropClass: ['cdk-overlay-dark-backdrop', 'cqa-dialog-backdrop'],
873
- scrollStrategy: this.overlay.scrollStrategies.block(),
874
- positionStrategy: this.overlay.position().global().centerHorizontally().centerVertically(),
875
- width: config.width,
876
- maxWidth: (_a = config.maxWidth) !== null && _a !== void 0 ? _a : '90vw',
877
- panelClass: ['cqa-dialog-panel', ...panelClass],
878
- });
879
- }
880
- }
881
- DialogService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: DialogService, deps: [{ token: i1$1.Overlay }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable });
882
- DialogService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: DialogService, providedIn: 'root' });
883
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: DialogService, decorators: [{
884
- type: Injectable,
885
- args: [{
886
- providedIn: 'root',
887
- }]
888
- }], ctorParameters: function () { return [{ type: i1$1.Overlay }, { type: i0.Injector }]; } });
889
-
890
- /**
891
- * Generated bundle index. Do not edit.
892
- */
893
-
894
- export { ButtonComponent, DIALOG_DATA, DIALOG_REF, DialogComponent, DialogRef, DialogService, SearchBarComponent, SegmentControlComponent, UiKitModule };
895
- //# sourceMappingURL=cqa-lib-cqa-ui.mjs.map