@aaamb/ngx-design-system 1.3.6 → 1.3.8

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 (108) hide show
  1. package/fesm2022/aaamb-ngx-design-system.mjs +4075 -0
  2. package/fesm2022/aaamb-ngx-design-system.mjs.map +1 -0
  3. package/package.json +14 -58
  4. package/styles/compiled.css +2 -0
  5. package/types/aaamb-ngx-design-system.d.ts +1142 -0
  6. package/.editorconfig +0 -17
  7. package/.nvmrc +0 -1
  8. package/.postcssrc.json +0 -5
  9. package/.storybook/main.ts +0 -20
  10. package/.storybook/preview.ts +0 -23
  11. package/.storybook/storybook.css +0 -1
  12. package/.storybook/tsconfig.json +0 -19
  13. package/.vscode/extensions.json +0 -4
  14. package/.vscode/launch.json +0 -20
  15. package/.vscode/tasks.json +0 -42
  16. package/CHANGELOG.md +0 -10
  17. package/LOCAL_DEVELOPMENT.md +0 -129
  18. package/angular.json +0 -74
  19. package/bitbucket-pipelines.yml +0 -41
  20. package/iac/bin/app.ts +0 -42
  21. package/iac/cdk.json +0 -82
  22. package/iac/lib/config/environments.ts +0 -19
  23. package/iac/lib/config/types.ts +0 -13
  24. package/iac/lib/stacks/certificate-stack.ts +0 -34
  25. package/iac/lib/stacks/frontend-stack.ts +0 -120
  26. package/iac/lib/stacks/index.ts +0 -2
  27. package/iac/package-lock.json +0 -726
  28. package/iac/package.json +0 -25
  29. package/iac/tsconfig.json +0 -24
  30. package/ng-package.json +0 -8
  31. package/src/components/button/button-green.stories.ts +0 -101
  32. package/src/components/button/button-text.stories.ts +0 -105
  33. package/src/components/button/button-white.stories.ts +0 -105
  34. package/src/components/button/button.component.stories.ts +0 -91
  35. package/src/components/button/button.component.ts +0 -93
  36. package/src/components/checkbox/checkbox.component.html +0 -30
  37. package/src/components/checkbox/checkbox.component.stories.ts +0 -183
  38. package/src/components/checkbox/checkbox.component.ts +0 -211
  39. package/src/components/datepicker-selector/datepicker-selector.component.html +0 -103
  40. package/src/components/datepicker-selector/datepicker-selector.component.stories.ts +0 -69
  41. package/src/components/datepicker-selector/datepicker-selector.component.ts +0 -287
  42. package/src/components/error-message/error-message.component.html +0 -3
  43. package/src/components/error-message/error-message.component.ts +0 -13
  44. package/src/components/filter-button/filter-button.component.html +0 -286
  45. package/src/components/filter-button/filter-button.component.stories.ts +0 -123
  46. package/src/components/filter-button/filter-button.component.ts +0 -582
  47. package/src/components/icon/icon.component.ts +0 -20
  48. package/src/components/icon/icon.html +0 -1333
  49. package/src/components/icon/icon.stories.ts +0 -49
  50. package/src/components/icon/icons-list.stories.ts +0 -42
  51. package/src/components/input/input.component.stories.ts +0 -101
  52. package/src/components/input/input.component.ts +0 -317
  53. package/src/components/input/input.html +0 -160
  54. package/src/components/input-datepicker/input-datepicker.component.ts +0 -356
  55. package/src/components/input-datepicker/input-datepicker.html +0 -69
  56. package/src/components/input-datepicker/input-datepicker.stories.ts +0 -99
  57. package/src/components/input-rangepicker/input-rangepicker.component.ts +0 -365
  58. package/src/components/input-rangepicker/input-rangepicker.html +0 -54
  59. package/src/components/input-rangepicker/input-rangepicker.stories.ts +0 -88
  60. package/src/components/input-weekpicker/input-weekpicker.component.ts +0 -417
  61. package/src/components/input-weekpicker/input-weekpicker.html +0 -54
  62. package/src/components/input-weekpicker/input-weekpicker.stories.ts +0 -103
  63. package/src/components/label/label.component.html +0 -20
  64. package/src/components/label/label.component.ts +0 -22
  65. package/src/components/modals/delicate-confirmation-modal/delicate-confirmation-modal.component.html +0 -32
  66. package/src/components/modals/delicate-confirmation-modal/delicate-confirmation-modal.component.stories.ts +0 -57
  67. package/src/components/modals/delicate-confirmation-modal/delicate-confirmation-modal.component.ts +0 -48
  68. package/src/components/modals/feedback-modal/feedback-modal.component.html +0 -118
  69. package/src/components/modals/feedback-modal/feedback-modal.component.stories.ts +0 -93
  70. package/src/components/modals/feedback-modal/feedback-modal.component.ts +0 -187
  71. package/src/components/modals/help-modal/help-modal.component.html +0 -32
  72. package/src/components/modals/help-modal/help-modal.component.stories.ts +0 -76
  73. package/src/components/modals/help-modal/help-modal.component.ts +0 -54
  74. package/src/components/modals/information-modal/information-modal.component.html +0 -24
  75. package/src/components/modals/information-modal/information-modal.component.stories.ts +0 -62
  76. package/src/components/modals/information-modal/information-modal.component.ts +0 -35
  77. package/src/components/modals/main-modal/main-modal.component.html +0 -85
  78. package/src/components/modals/main-modal/main-modal.component.stories.ts +0 -127
  79. package/src/components/modals/main-modal/main-modal.component.ts +0 -85
  80. package/src/components/modals/notification-modal/notification-modal.component.html +0 -22
  81. package/src/components/modals/notification-modal/notification-modal.component.stories.ts +0 -59
  82. package/src/components/modals/notification-modal/notification-modal.component.ts +0 -37
  83. package/src/components/selectors/multiple-selector/multiple-selector.component.html +0 -51
  84. package/src/components/selectors/multiple-selector/multiple-selector.component.stories.ts +0 -306
  85. package/src/components/selectors/multiple-selector/multiple-selector.component.ts +0 -308
  86. package/src/components/selectors/single-selector/single-selector.component.html +0 -46
  87. package/src/components/selectors/single-selector/single-selector.component.stories.ts +0 -294
  88. package/src/components/selectors/single-selector/single-selector.component.ts +0 -239
  89. package/src/components/side-nav/side-nav.component.stories.ts +0 -157
  90. package/src/components/side-nav/side-nav.component.ts +0 -306
  91. package/src/components/snackbar/snackbar.component.ts +0 -150
  92. package/src/components/snackbar/snackbar.html +0 -21
  93. package/src/components/snackbar/snackbar.stories.ts +0 -51
  94. package/src/components/state/state.component.ts +0 -30
  95. package/src/components/state/state.html +0 -13
  96. package/src/components/state/state.stories.ts +0 -74
  97. package/src/components/table/table.component.html +0 -441
  98. package/src/components/table/table.component.scss +0 -28
  99. package/src/components/table/table.component.stories.ts +0 -655
  100. package/src/components/table/table.component.ts +0 -475
  101. package/src/components/tabs/tabs.component.stories.ts +0 -114
  102. package/src/components/tabs/tabs.component.ts +0 -69
  103. package/src/core/types.ts +0 -486
  104. package/src/public-api.ts +0 -23
  105. package/tsconfig.json +0 -37
  106. package/tsconfig.lib.json +0 -17
  107. package/tsconfig.lib.prod.json +0 -9
  108. package/tsconfig.spec.json +0 -13
@@ -1,417 +0,0 @@
1
- import {
2
- Component,
3
- ElementRef,
4
- forwardRef,
5
- HostListener,
6
- input,
7
- signal,
8
- ViewChild,
9
- } from '@angular/core';
10
- import { NzDatePickerModule } from 'ng-zorro-antd/date-picker';
11
- import { CommonModule } from '@angular/common';
12
- import {
13
- ControlValueAccessor,
14
- FormsModule,
15
- NG_VALUE_ACCESSOR,
16
- } from '@angular/forms';
17
- import { IconComponent } from '../icon/icon.component';
18
- import { LabelComponent } from '../label/label.component';
19
- import { ErrorMessageComponent } from '../error-message/error-message.component';
20
-
21
- @Component({
22
- imports: [
23
- NzDatePickerModule,
24
- CommonModule,
25
- FormsModule,
26
- IconComponent,
27
- LabelComponent,
28
- ErrorMessageComponent,
29
- ],
30
- selector: 'ads-input-weekpicker',
31
- templateUrl: './input-weekpicker.html',
32
- providers: [
33
- {
34
- provide: NG_VALUE_ACCESSOR,
35
- useExisting: forwardRef(() => InputWeekpickerComponent),
36
- multi: true,
37
- },
38
- ],
39
- })
40
- export class InputWeekpickerComponent implements ControlValueAccessor {
41
- isPickerDisabled = input<boolean>(false);
42
- weekPickerPlaceholder = input<string>('MM/DD/YYYY - MM/DD/YYYY');
43
- hasError = input<boolean>(false);
44
- errorMessage = input<string>('Please enter a valid date range.');
45
- isDatePickerOpen = false;
46
- selectedWeek = signal<string>('');
47
- selectedWeekRange = signal<[Date, Date] | null>(null);
48
- invalidInput = signal<boolean>(false);
49
- futureDatesAllowed = input<boolean>(false);
50
- label = input<string>('');
51
-
52
- @ViewChild('datePicker') datePickerRef: any;
53
-
54
- private cvaDisabled = false;
55
-
56
- private onChange: (value: string) => void = () => {};
57
- private onTouched: () => void = () => {};
58
-
59
- basicClass =
60
- 'w-full rounded-lg border border-solid px-3 py-2 text-sm outline-none placeholder:neutral-disabled-text';
61
-
62
- isDisabled(): boolean {
63
- return this.isPickerDisabled() || this.cvaDisabled;
64
- }
65
-
66
- activeInputClass(): string {
67
- return 'hover:border-aqua-2 focus:border-aqua-2';
68
- }
69
-
70
- errorActiveClass(): string {
71
- return 'hover:border-red-1 focus:border-red-1';
72
- }
73
-
74
- inputStateClass(): string {
75
- if (this.isDisabled()) {
76
- return `${this.basicClass} border-neutral-disabled-bg bg-neutral-disabled-bg text-neutral-disabled-text placeholder:neutral-disabled-text cursor-default`;
77
- }
78
-
79
- if (this.hasError()) {
80
- return `${this.basicClass} ${this.errorActiveClass()} border-red-3 bg-red-6 text-green-base`;
81
- }
82
-
83
- return `${this.basicClass} ${this.activeInputClass()} border-aqua-5 bg-aqua-6 focus:border-primary text-green-base`;
84
- }
85
-
86
- onInputValue(value: any): void {
87
- const date = this.toDate(value);
88
-
89
- if (!date) {
90
- this.invalidInput.set(true);
91
- this.selectedWeekRange.set(null);
92
- this.selectedWeek.set('');
93
- this.onChange('');
94
- return;
95
- }
96
-
97
- if (!this.futureDatesAllowed() && this.isFutureDate(date)) {
98
- this.invalidInput.set(true);
99
- this.selectedWeekRange.set(null);
100
- this.selectedWeek.set('');
101
- this.onChange('');
102
- return;
103
- }
104
-
105
- const week = this.getISOWeek(date);
106
- const year = this.getISOYear(date);
107
- const start = this.getDateFromISOWeek(year, week);
108
- const end = new Date(start);
109
- end.setDate(start.getDate() + 6);
110
-
111
- this.invalidInput.set(false);
112
- this.selectedWeekRange.set([start, end]);
113
- const formatted = `${this.formatDate(start)} - ${this.formatDate(end)}`;
114
- this.selectedWeek.set(formatted);
115
- this.onChange(formatted);
116
- }
117
-
118
- onInputTextChange(text: string): void {
119
- const rawText = text ?? '';
120
-
121
- const normalizedText = this.normalizeToUsRangeFormat(rawText);
122
- this.selectedWeek.set(normalizedText);
123
-
124
- if (!normalizedText.trim()) {
125
- this.invalidInput.set(false);
126
- this.selectedWeek.set('');
127
- this.selectedWeekRange.set(null);
128
- this.onChange('');
129
- return;
130
- }
131
-
132
- const parsedRange = this.parseRange(normalizedText);
133
-
134
- if (parsedRange) {
135
- const [start, end] = parsedRange;
136
-
137
- if (!this.futureDatesAllowed() && this.hasFutureDateInRange([start, end])) {
138
- this.invalidInput.set(true);
139
- this.selectedWeekRange.set(null);
140
- this.selectedWeek.set('');
141
- this.onChange('');
142
- return;
143
- }
144
-
145
- this.invalidInput.set(false);
146
- this.selectedWeekRange.set([start, end]);
147
- const formatted = `${this.formatDate(start)} - ${this.formatDate(end)}`;
148
- this.selectedWeek.set(formatted);
149
- this.onChange(formatted);
150
- return;
151
- }
152
-
153
- this.invalidInput.set(true);
154
- this.selectedWeekRange.set(null);
155
- this.onChange(normalizedText);
156
- }
157
-
158
- private normalizeToUsRangeFormat(text: string): string {
159
- const digits = text.replace(/\D/g, '');
160
-
161
- if (digits.length === 16) {
162
- return `${digits.slice(0, 2)}/${digits.slice(2, 4)}/${digits.slice(4, 8)} - ${digits.slice(8, 10)}/${digits.slice(10, 12)}/${digits.slice(12, 16)}`;
163
- }
164
-
165
- return text;
166
- }
167
-
168
- private parseRange(text: string): [Date, Date] | null {
169
- const normalized = text.trim();
170
- const strictRangePattern = /^\d{2}\/\d{2}\/\d{4}\s-\s\d{2}\/\d{2}\/\d{4}$/;
171
-
172
- if (!strictRangePattern.test(normalized)) return null;
173
-
174
- const [startText, endText] = normalized.split(' - ');
175
- const start = this.parseDate(startText);
176
- const end = this.parseDate(endText);
177
-
178
- if (!start || !end) return null;
179
-
180
- return [start, end];
181
- }
182
-
183
- private toDateRange(value: unknown): [Date, Date] | null {
184
- if (!value) return null;
185
-
186
- if (Array.isArray(value) && value.length === 2) {
187
- const start = this.toDate(value[0]);
188
- const end = this.toDate(value[1]);
189
-
190
- if (!start || !end) return null;
191
-
192
- return [start, end];
193
- }
194
-
195
- if (typeof value === 'string') {
196
- return this.parseRange(value);
197
- }
198
-
199
- return null;
200
- }
201
-
202
- private parseDate(text: string): Date | null {
203
- const normalized = text.trim();
204
- const strictDatePattern = /^\d{2}\/\d{2}\/\d{4}$/;
205
-
206
- if (!strictDatePattern.test(normalized)) return null;
207
-
208
- const parts = normalized.split('/');
209
- if (parts.length !== 3) return null;
210
-
211
- const [monthStr, dayStr, yearStr] = parts;
212
- const month = parseInt(monthStr, 10);
213
- const day = parseInt(dayStr, 10);
214
- const year = parseInt(yearStr, 10);
215
-
216
- if (isNaN(month) || isNaN(day) || isNaN(year)) return null;
217
- if (month < 1 || month > 12 || day < 1 || day > 31) return null;
218
-
219
- const date = new Date(year, month - 1, day);
220
- if (date.getMonth() !== month - 1 || date.getDate() !== day) return null;
221
-
222
- return date;
223
- }
224
-
225
- private formatDate(date: Date): string {
226
- const month = String(date.getMonth() + 1).padStart(2, '0');
227
- const day = String(date.getDate()).padStart(2, '0');
228
- const year = date.getFullYear();
229
- return `${month}/${day}/${year}`;
230
- }
231
-
232
- private toDate(value: unknown): Date | null {
233
- if (!value) return null;
234
-
235
- if (value instanceof Date) {
236
- return Number.isNaN(value.getTime()) ? null : value;
237
- }
238
-
239
- if (typeof value === 'string') {
240
- const parsedDate = this.parseDate(value);
241
- if (parsedDate) return parsedDate;
242
-
243
- const parsedRange = this.parseRange(value);
244
- if (parsedRange) return parsedRange[0];
245
-
246
- if (!this.isIsoDateString(value)) return null;
247
- const isoDate = new Date(value);
248
- return Number.isNaN(isoDate.getTime()) ? null : isoDate;
249
- }
250
-
251
- if (typeof value === 'object' && value !== null) {
252
- const maybeWithToDate = value as { toDate?: () => Date };
253
- if (typeof maybeWithToDate.toDate === 'function') {
254
- const converted = maybeWithToDate.toDate();
255
- return Number.isNaN(converted.getTime()) ? null : converted;
256
- }
257
-
258
- const maybeWithNativeDate = value as { $d?: Date };
259
- if (maybeWithNativeDate.$d instanceof Date) {
260
- return Number.isNaN(maybeWithNativeDate.$d.getTime())
261
- ? null
262
- : maybeWithNativeDate.$d;
263
- }
264
- }
265
-
266
- return null;
267
- }
268
-
269
- private isIsoDateString(value: string): boolean {
270
- return /^\d{4}-\d{2}-\d{2}(?:[T\s].*)?$/.test(value.trim());
271
- }
272
-
273
- private getISOWeek(date: Date): number {
274
- const d = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate()));
275
- const dayNum = d.getUTCDay() || 7;
276
- d.setUTCDate(d.getUTCDate() + 4 - dayNum);
277
- const yearStart = new Date(Date.UTC(d.getUTCFullYear(), 0, 1));
278
- return Math.ceil((((d.getTime() - yearStart.getTime()) / 86400000) + 1) / 7);
279
- }
280
-
281
- private getISOYear(date: Date): number {
282
- const d = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate()));
283
- const dayNum = d.getUTCDay() || 7;
284
- d.setUTCDate(d.getUTCDate() + 4 - dayNum);
285
- return d.getUTCFullYear();
286
- }
287
-
288
- private getDateFromISOWeek(year: number, week: number): Date {
289
- const simple = new Date(year, 0, 1 + (week - 1) * 7);
290
- const dow = simple.getDay();
291
- const ISOweekStart = simple;
292
- if (dow <= 4)
293
- ISOweekStart.setDate(simple.getDate() - simple.getDay() + 1);
294
- else
295
- ISOweekStart.setDate(simple.getDate() + 8 - simple.getDay());
296
- return ISOweekStart;
297
- }
298
-
299
- openDatePicker(): void {
300
- this.isDatePickerOpen = !this.isDatePickerOpen;
301
- }
302
-
303
- onOpenChange(isOpen: boolean): void {
304
- this.isDatePickerOpen = isOpen;
305
- }
306
-
307
- onInputBlur(): void {
308
- this.onTouched();
309
- }
310
-
311
- onInputKeyDown(event: KeyboardEvent): void {
312
- if (event.key !== 'Backspace' && event.key !== 'Delete') {
313
- return;
314
- }
315
-
316
- event.preventDefault();
317
- this.clearSelection();
318
- }
319
-
320
- private clearSelection(): void {
321
- this.invalidInput.set(false);
322
- this.selectedWeek.set('');
323
- this.selectedWeekRange.set(null);
324
- this.onChange('');
325
- }
326
-
327
- writeValue(value: unknown): void {
328
- const parsedRange = this.toDateRange(value);
329
-
330
- if (parsedRange) {
331
- const [start, end] = parsedRange;
332
- this.invalidInput.set(false);
333
- this.selectedWeekRange.set([start, end]);
334
- this.selectedWeek.set(`${this.formatDate(start)} - ${this.formatDate(end)}`);
335
- return;
336
- }
337
-
338
- if (typeof value === 'string') {
339
- const normalizedText = this.normalizeToUsRangeFormat(value);
340
- this.selectedWeek.set(normalizedText);
341
- const parsed = this.parseRange(normalizedText);
342
- this.selectedWeekRange.set(parsed);
343
- this.invalidInput.set(normalizedText.trim().length > 0 && !parsed);
344
- return;
345
- }
346
-
347
- this.invalidInput.set(false);
348
- this.selectedWeek.set('');
349
- this.selectedWeekRange.set(null);
350
- }
351
-
352
- hasVisualError(): boolean {
353
- return this.hasError() || this.invalidInput();
354
- }
355
-
356
- resolvedErrorMessage(): string {
357
- if (this.hasError()) {
358
- return this.errorMessage();
359
- }
360
-
361
- return this.invalidInput() ? this.errorMessage() : '';
362
- }
363
-
364
- registerOnChange(fn: (value: string) => void): void {
365
- this.onChange = fn;
366
- }
367
-
368
- registerOnTouched(fn: () => void): void {
369
- this.onTouched = fn;
370
- }
371
-
372
- setDisabledState(isDisabled: boolean): void {
373
- this.cvaDisabled = isDisabled;
374
- }
375
-
376
- @HostListener('document:click', ['$event'])
377
- onDocumentClick(event: MouseEvent): void {
378
- if (!this.isDatePickerOpen) {
379
- return;
380
- }
381
-
382
- const target = event.target as HTMLElement;
383
- const containerElement = this.elementRef?.nativeElement;
384
-
385
- if (target instanceof Element && containerElement?.contains(target)) {
386
- return;
387
- }
388
-
389
- if (target instanceof Element && target.closest('.cdk-overlay-pane')) {
390
- return;
391
- }
392
-
393
- this.isDatePickerOpen = false;
394
- }
395
-
396
- disabledDate = (current: Date): boolean => {
397
- if (this.futureDatesAllowed()) return false;
398
- return this.isFutureDate(current);
399
- };
400
-
401
- private isFutureDate(date: Date): boolean {
402
- const today = new Date();
403
- today.setHours(0, 0, 0, 0);
404
-
405
- const comparedDate = new Date(date);
406
- comparedDate.setHours(0, 0, 0, 0);
407
-
408
- return comparedDate.getTime() > today.getTime();
409
- }
410
-
411
- private hasFutureDateInRange(range: [Date, Date]): boolean {
412
- const [start, end] = range;
413
- return this.isFutureDate(start) || this.isFutureDate(end);
414
- }
415
-
416
- constructor(private elementRef: ElementRef) {}
417
- }
@@ -1,54 +0,0 @@
1
- <div class="flex w-full flex-col">
2
- <ads-label [text]="label()"></ads-label>
3
-
4
- <div class="relative w-full h-9.5">
5
- <input
6
- type="text"
7
- [class]="inputStateClass() + ' pr-12'"
8
- [disabled]="isDisabled()"
9
- [placeholder]="'Choose your week'"
10
- [ngModel]="selectedWeek()"
11
- (blur)="onInputBlur()"
12
- (keydown)="onInputKeyDown($event)"
13
- readonly
14
- />
15
- <button
16
- type="button"
17
- [disabled]="isDisabled()"
18
- (click)="openDatePicker()"
19
- class="w-6 h-6 top-[50%] translate-y-[-50%] absolute right-3 flex items-center justify-center border-0 outline-none ring-0 focus:outline-none focus:ring-0 active:outline-none active:ring-0 bg-transparent"
20
- >
21
- <ads-icon
22
- [ngClass]="{
23
- 'cursor-pointer': !isDisabled(),
24
- 'text-green-1': !hasVisualError() && !isDisabled(),
25
- 'text-red-2': hasVisualError(),
26
- 'text-gray-500': isDisabled(),
27
- }"
28
- [iconName]="'calendar'"
29
- [size]="24"
30
- ></ads-icon>
31
- </button>
32
- <nz-date-picker
33
- style="position: absolute"
34
- class="opacity-0 pointer-events-none w-full h-full left-0 top-0"
35
- #datePicker
36
- [ngModel]="selectedWeekRange()?.[0] ?? null"
37
- [nzDisabled]="isDisabled()"
38
- [nzDisabledDate]="disabledDate"
39
- [nzOpen]="isDatePickerOpen"
40
- [nzPlaceHolder]="weekPickerPlaceholder()"
41
- [nzPlacement]="'bottomRight'"
42
- [nzMode]="'week'"
43
- [nzFormat]="'MM/dd/yyyy'"
44
- (ngModelChange)="onInputValue($event)"
45
- (nzOnOpenChange)="onOpenChange($event)"
46
- [nzShowWeekNumber]="true"
47
- ></nz-date-picker>
48
- </div>
49
-
50
- <ads-error-message
51
- [hasError]="hasVisualError()"
52
- [errorMessage]="resolvedErrorMessage()"
53
- ></ads-error-message>
54
- </div>
@@ -1,103 +0,0 @@
1
- import { Meta, StoryObj } from '@storybook/angular';
2
- import { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms';
3
- import { InputWeekpickerComponent } from './input-weekpicker.component';
4
-
5
- type InputWeekpickerProps = InputWeekpickerComponent;
6
-
7
- const meta: Meta<InputWeekpickerProps> = {
8
- title: 'Components/Input Weekpicker',
9
- component: InputWeekpickerComponent,
10
- argTypes: {
11
- label: { control: 'text' },
12
- weekPickerPlaceholder: { control: 'text' },
13
- hasError: { control: 'boolean' },
14
- isPickerDisabled: { control: 'boolean' },
15
- futureDatesAllowed: { control: 'boolean' },
16
- },
17
- render: (args) => ({
18
- props: args,
19
- template: `
20
- <div class="w-100">
21
- <ads-input-weekpicker
22
- [label]="label"
23
- [weekPickerPlaceholder]="weekPickerPlaceholder"
24
- [hasError]="hasError"
25
- [isPickerDisabled]="isPickerDisabled"
26
- [futureDatesAllowed]="futureDatesAllowed"
27
- ></ads-input-weekpicker>
28
- </div>
29
- `,
30
- }),
31
- };
32
-
33
- export default meta;
34
- type Story = StoryObj<InputWeekpickerProps>;
35
-
36
- export const Playground: Story = {
37
- args: {
38
- label: 'Week',
39
- weekPickerPlaceholder: 'MM/DD/YYYY - MM/DD/YYYY',
40
- hasError: false,
41
- isPickerDisabled: false,
42
- futureDatesAllowed: false,
43
- },
44
- };
45
-
46
- export const WithError: Story = {
47
- args: {
48
- label: 'Week',
49
- weekPickerPlaceholder: 'MM/DD/YYYY - MM/DD/YYYY',
50
- hasError: true,
51
- isPickerDisabled: false,
52
- futureDatesAllowed: false,
53
- },
54
- };
55
-
56
- export const Disabled: Story = {
57
- args: {
58
- label: 'Week',
59
- weekPickerPlaceholder: 'MM/DD/YYYY - MM/DD/YYYY',
60
- hasError: false,
61
- isPickerDisabled: true,
62
- futureDatesAllowed: false,
63
- },
64
- };
65
-
66
- export const ReactiveForms: Story = {
67
- args: {
68
- label: 'Week',
69
- weekPickerPlaceholder: 'MM/DD/YYYY - MM/DD/YYYY',
70
- hasError: false,
71
- isPickerDisabled: false,
72
- futureDatesAllowed: false,
73
- },
74
- render: (args) => {
75
- const form = new FormGroup({
76
- week: new FormControl(''),
77
- });
78
-
79
- return {
80
- moduleMetadata: {
81
- imports: [ReactiveFormsModule],
82
- },
83
- props: {
84
- ...args,
85
- form,
86
- },
87
- template: `
88
- <div class="w-100">
89
- <form [formGroup]="form">
90
- <ads-input-weekpicker
91
- formControlName="week"
92
- [label]="label"
93
- [weekPickerPlaceholder]="weekPickerPlaceholder"
94
- [hasError]="hasError"
95
- [isPickerDisabled]="isPickerDisabled"
96
- [futureDatesAllowed]="futureDatesAllowed"
97
- ></ads-input-weekpicker>
98
- </form>
99
- </div>
100
- `,
101
- };
102
- },
103
- };
@@ -1,20 +0,0 @@
1
- <div class="flex items-center gap-1.5 mb-1">
2
- @if (text()) {
3
- <label class="text-sm font-medium text-green-1">{{ text() }}</label>
4
- }
5
-
6
- @if (iconName()) {
7
- <button
8
- type="button"
9
- (click)="onLabelButtonClick()"
10
- class="border-0 outline-none ring-0 focus:outline-none focus:ring-0 active:outline-none active:ring-0 bg-transparent p-0 cursor-pointer flex items-center justify-center hover:opacity-75 transition-opacity"
11
- >
12
- <ads-icon
13
- [iconName]="iconName()"
14
- [size]="iconSize()"
15
- style="width: 14px; height: 14px"
16
- class="text-green-1"
17
- ></ads-icon>
18
- </button>
19
- }
20
- </div>
@@ -1,22 +0,0 @@
1
- import { Component, input, output } from '@angular/core';
2
- import { CommonModule } from '@angular/common';
3
- import { IconComponent } from '../icon/icon.component';
4
- import { AdsIconName } from '../../core/types';
5
-
6
- @Component({
7
- selector: 'ads-label',
8
- standalone: true,
9
- imports: [CommonModule, IconComponent],
10
- templateUrl: './label.component.html',
11
- })
12
- export class LabelComponent {
13
- text = input<string>('');
14
- iconName = input<AdsIconName | null>(null);
15
- iconSize = input<30 | 24 | 16>(16);
16
-
17
- iconClicked = output<void>();
18
-
19
- onLabelButtonClick(): void {
20
- this.iconClicked.emit();
21
- }
22
- }
@@ -1,32 +0,0 @@
1
- <ads-main-modal
2
- [open]="open()"
3
- width="35rem"
4
- [showCloseButton]="false"
5
- [actionsAlign]="'center'"
6
- [actions]="actions()"
7
- [closeOnBackdrop]="closeOnBackdrop()"
8
- [closeOnEsc]="closeOnEsc()"
9
- (closed)="closed.emit()"
10
- [buttonsFullWidth]="buttonsFullWidth()"
11
- >
12
- <div
13
- ads-main-modal-header-extra
14
- class="flex items-center gap-6 h-full w-full"
15
- >
16
- <div
17
- class="inline-flex h-full w-fit items-center justify-center rounded-full text-green-base"
18
- aria-hidden="true"
19
- >
20
- <ads-icon [iconName]="iconName()" [size]="30" />
21
- </div>
22
-
23
- <h2 class="text-[1.6rem] font-semibold leading-tight text-green-base m-0">
24
- {{ title() }}
25
- </h2>
26
- </div>
27
- <p
28
- class="m-0 whitespace-pre-line text-[15px] leading-6 text-green-base pl-13.5 pt-4 pb-8"
29
- >
30
- {{ description() }}
31
- </p>
32
- </ads-main-modal>
@@ -1,57 +0,0 @@
1
- import { Meta, StoryObj } from '@storybook/angular';
2
- import { DelicateConfirmationModalComponent } from './delicate-confirmation-modal.component';
3
-
4
- const meta: Meta<DelicateConfirmationModalComponent> = {
5
- title: 'Components/Modals/Delicate Confirmation Modal',
6
- component: DelicateConfirmationModalComponent,
7
- args: {
8
- open: true,
9
- title: 'Delete Task',
10
- description:
11
- "Are you sure you want to delete this Task?\nThis action can't be undone.",
12
- cancelText: 'Cancel',
13
- confirmText: 'Delete',
14
- buttonsFullWidth: true,
15
- },
16
- argTypes: {
17
- open: { control: 'boolean' },
18
- title: { control: 'text' },
19
- description: { control: 'text' },
20
- cancelText: { control: 'text' },
21
- confirmText: { control: 'text' },
22
- buttonsFullWidth: { control: 'boolean' },
23
- },
24
- render: (args) => ({
25
- props: (() => {
26
- let modalOpen = args.open;
27
-
28
- return {
29
- ...args,
30
- get open() {
31
- return modalOpen;
32
- },
33
- set open(value: boolean) {
34
- modalOpen = value;
35
- },
36
- };
37
- })(),
38
- template: `
39
- <ads-delicate-confirmation-modal
40
- [open]="open"
41
- [title]="title"
42
- [description]="description"
43
- [cancelText]="cancelText"
44
- [confirmText]="confirmText"
45
- [buttonsFullWidth]="buttonsFullWidth"
46
- (closed)="closeModal()"
47
- (cancel)="closeModal()"
48
- (confirm)="closeModal()"
49
- ></ads-delicate-confirmation-modal>
50
- `,
51
- }),
52
- };
53
-
54
- export default meta;
55
- type Story = StoryObj<DelicateConfirmationModalComponent>;
56
-
57
- export const Playground: Story = {};