@aaamb/ngx-design-system 1.4.0 → 1.4.1

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/.editorconfig +17 -0
  2. package/.nvmrc +1 -0
  3. package/.postcssrc.json +5 -0
  4. package/.storybook/main.ts +20 -0
  5. package/.storybook/preview.ts +23 -0
  6. package/.storybook/storybook.css +1 -0
  7. package/.storybook/tsconfig.json +19 -0
  8. package/.vscode/extensions.json +4 -0
  9. package/.vscode/launch.json +20 -0
  10. package/.vscode/tasks.json +42 -0
  11. package/CHANGELOG.md +10 -0
  12. package/LOCAL_DEVELOPMENT.md +129 -0
  13. package/angular.json +74 -0
  14. package/bitbucket-pipelines.yml +41 -0
  15. package/iac/bin/app.ts +42 -0
  16. package/iac/cdk.json +82 -0
  17. package/iac/lib/config/environments.ts +19 -0
  18. package/iac/lib/config/types.ts +13 -0
  19. package/iac/lib/stacks/certificate-stack.ts +34 -0
  20. package/iac/lib/stacks/frontend-stack.ts +120 -0
  21. package/iac/lib/stacks/index.ts +2 -0
  22. package/iac/package-lock.json +726 -0
  23. package/iac/package.json +25 -0
  24. package/iac/tsconfig.json +24 -0
  25. package/ng-package.json +8 -0
  26. package/package.json +58 -14
  27. package/src/components/button/button-green.stories.ts +101 -0
  28. package/src/components/button/button-text.stories.ts +105 -0
  29. package/src/components/button/button-white.stories.ts +105 -0
  30. package/src/components/button/button.component.stories.ts +91 -0
  31. package/src/components/button/button.component.ts +93 -0
  32. package/src/components/checkbox/checkbox.component.html +30 -0
  33. package/src/components/checkbox/checkbox.component.stories.ts +183 -0
  34. package/src/components/checkbox/checkbox.component.ts +211 -0
  35. package/src/components/datepicker-selector/datepicker-selector.component.html +103 -0
  36. package/src/components/datepicker-selector/datepicker-selector.component.stories.ts +123 -0
  37. package/src/components/datepicker-selector/datepicker-selector.component.ts +337 -0
  38. package/src/components/error-message/error-message.component.html +3 -0
  39. package/src/components/error-message/error-message.component.ts +13 -0
  40. package/src/components/filter-button/filter-button.component.html +286 -0
  41. package/src/components/filter-button/filter-button.component.stories.ts +123 -0
  42. package/src/components/filter-button/filter-button.component.ts +582 -0
  43. package/src/components/icon/icon.component.ts +20 -0
  44. package/src/components/icon/icon.html +1424 -0
  45. package/src/components/icon/icon.stories.ts +49 -0
  46. package/src/components/icon/icons-list.stories.ts +42 -0
  47. package/src/components/input/input.component.stories.ts +101 -0
  48. package/src/components/input/input.component.ts +317 -0
  49. package/src/components/input/input.html +160 -0
  50. package/src/components/input-datepicker/input-datepicker.component.ts +356 -0
  51. package/src/components/input-datepicker/input-datepicker.html +69 -0
  52. package/src/components/input-datepicker/input-datepicker.stories.ts +99 -0
  53. package/src/components/input-rangepicker/input-rangepicker.component.ts +365 -0
  54. package/src/components/input-rangepicker/input-rangepicker.html +54 -0
  55. package/src/components/input-rangepicker/input-rangepicker.stories.ts +88 -0
  56. package/src/components/input-weekpicker/input-weekpicker.component.ts +417 -0
  57. package/src/components/input-weekpicker/input-weekpicker.html +54 -0
  58. package/src/components/input-weekpicker/input-weekpicker.stories.ts +103 -0
  59. package/src/components/label/label.component.html +20 -0
  60. package/src/components/label/label.component.ts +22 -0
  61. package/src/components/modals/delicate-confirmation-modal/delicate-confirmation-modal.component.html +32 -0
  62. package/src/components/modals/delicate-confirmation-modal/delicate-confirmation-modal.component.stories.ts +57 -0
  63. package/src/components/modals/delicate-confirmation-modal/delicate-confirmation-modal.component.ts +48 -0
  64. package/src/components/modals/feedback-modal/feedback-modal.component.html +118 -0
  65. package/src/components/modals/feedback-modal/feedback-modal.component.stories.ts +93 -0
  66. package/src/components/modals/feedback-modal/feedback-modal.component.ts +187 -0
  67. package/src/components/modals/help-modal/help-modal.component.html +32 -0
  68. package/src/components/modals/help-modal/help-modal.component.stories.ts +76 -0
  69. package/src/components/modals/help-modal/help-modal.component.ts +54 -0
  70. package/src/components/modals/information-modal/information-modal.component.html +24 -0
  71. package/src/components/modals/information-modal/information-modal.component.stories.ts +62 -0
  72. package/src/components/modals/information-modal/information-modal.component.ts +35 -0
  73. package/src/components/modals/main-modal/main-modal.component.html +85 -0
  74. package/src/components/modals/main-modal/main-modal.component.stories.ts +127 -0
  75. package/src/components/modals/main-modal/main-modal.component.ts +85 -0
  76. package/src/components/modals/notification-modal/notification-modal.component.html +22 -0
  77. package/src/components/modals/notification-modal/notification-modal.component.stories.ts +59 -0
  78. package/src/components/modals/notification-modal/notification-modal.component.ts +37 -0
  79. package/src/components/selectors/multiple-selector/multiple-selector.component.html +51 -0
  80. package/src/components/selectors/multiple-selector/multiple-selector.component.stories.ts +306 -0
  81. package/src/components/selectors/multiple-selector/multiple-selector.component.ts +308 -0
  82. package/src/components/selectors/single-selector/single-selector.component.html +46 -0
  83. package/src/components/selectors/single-selector/single-selector.component.stories.ts +294 -0
  84. package/src/components/selectors/single-selector/single-selector.component.ts +239 -0
  85. package/src/components/side-nav/side-nav.component.stories.ts +176 -0
  86. package/src/components/side-nav/side-nav.component.ts +325 -0
  87. package/src/components/snackbar/snackbar.component.ts +150 -0
  88. package/src/components/snackbar/snackbar.html +21 -0
  89. package/src/components/snackbar/snackbar.stories.ts +51 -0
  90. package/src/components/state/state.component.ts +30 -0
  91. package/src/components/state/state.html +13 -0
  92. package/src/components/state/state.stories.ts +74 -0
  93. package/src/components/table/table.component.html +466 -0
  94. package/src/components/table/table.component.scss +28 -0
  95. package/src/components/table/table.component.stories.ts +655 -0
  96. package/src/components/table/table.component.ts +475 -0
  97. package/src/components/tabs/tabs.component.stories.ts +114 -0
  98. package/src/components/tabs/tabs.component.ts +69 -0
  99. package/src/core/types.ts +494 -0
  100. package/src/public-api.ts +23 -0
  101. package/tsconfig.json +37 -0
  102. package/tsconfig.lib.json +17 -0
  103. package/tsconfig.lib.prod.json +9 -0
  104. package/tsconfig.spec.json +13 -0
  105. package/fesm2022/aaamb-ngx-design-system.mjs +0 -4115
  106. package/fesm2022/aaamb-ngx-design-system.mjs.map +0 -1
  107. package/styles/compiled.css +0 -2
  108. package/types/aaamb-ngx-design-system.d.ts +0 -1146
@@ -0,0 +1,356 @@
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 { NgxMaskDirective, provideNgxMask } from 'ngx-mask';
19
+ import { LabelComponent } from '../label/label.component';
20
+ import { ErrorMessageComponent } from '../error-message/error-message.component';
21
+
22
+ @Component({
23
+ imports: [
24
+ NzDatePickerModule,
25
+ CommonModule,
26
+ FormsModule,
27
+ IconComponent,
28
+ NgxMaskDirective,
29
+ LabelComponent,
30
+ ErrorMessageComponent,
31
+ ],
32
+ selector: 'ads-input-datepicker',
33
+ templateUrl: './input-datepicker.html',
34
+ providers: [
35
+ provideNgxMask(),
36
+ {
37
+ provide: NG_VALUE_ACCESSOR,
38
+ useExisting: forwardRef(() => InputDatepickerComponent),
39
+ multi: true,
40
+ },
41
+ ],
42
+ })
43
+ export class InputDatepickerComponent implements ControlValueAccessor {
44
+ isPickerDisabled = input<boolean>(false);
45
+ datePickerPlaceholder = input<string>('Select date');
46
+ hasError = input<boolean>(false);
47
+ errorMessage = input<string>('Please enter a valid date.');
48
+ isDatePickerOpen = false;
49
+ selectedDate = signal<string>('');
50
+ selectedDateObj = signal<Date | null>(null);
51
+ invalidInput = signal<boolean>(false);
52
+ futureDatesAllowed = input<boolean>(false);
53
+ label = input<string>('');
54
+ monthlyPicker = input<boolean>(false);
55
+
56
+ @ViewChild('datePicker') datePickerRef: any;
57
+
58
+ private cvaDisabled = false;
59
+
60
+ private onChange: (value: string) => void = () => {};
61
+ private onTouched: () => void = () => {};
62
+
63
+ basicClass =
64
+ 'w-full rounded-lg border border-solid px-3 py-2 text-sm outline-none placeholder:neutral-disabled-text';
65
+
66
+ isDisabled(): boolean {
67
+ return this.isPickerDisabled() || this.cvaDisabled;
68
+ }
69
+
70
+ activeInputClass(): string {
71
+ return 'hover:border-aqua-2 focus:border-aqua-2';
72
+ }
73
+
74
+ errorActiveClass(): string {
75
+ return 'hover:border-red-1 focus:border-red-1';
76
+ }
77
+
78
+ inputStateClass(): string {
79
+ if (this.isDisabled()) {
80
+ return `${this.basicClass} border-neutral-disabled-bg bg-neutral-disabled-bg text-neutral-disabled-text placeholder:neutral-disabled-text cursor-default`;
81
+ }
82
+
83
+ if (this.hasError()) {
84
+ return `${this.basicClass} ${this.errorActiveClass()} border-red-3 bg-red-6 text-green-base`;
85
+ }
86
+
87
+ return `${this.basicClass} ${this.activeInputClass()} border-aqua-5 bg-aqua-6 focus:border-primary text-green-base`;
88
+ }
89
+
90
+ onInputValue(value: any): void {
91
+ const date = this.toDate(value);
92
+
93
+ if (!date) {
94
+ this.invalidInput.set(true);
95
+ this.selectedDateObj.set(null);
96
+ this.selectedDate.set('');
97
+ this.onChange('');
98
+ return;
99
+ }
100
+
101
+ if (!this.futureDatesAllowed() && this.isFutureDate(date)) {
102
+ this.invalidInput.set(true);
103
+ this.selectedDateObj.set(null);
104
+ this.selectedDate.set('');
105
+ this.onChange('');
106
+ return;
107
+ }
108
+
109
+ this.invalidInput.set(false);
110
+ this.selectedDateObj.set(date);
111
+ const formatted = this.formatDate(date);
112
+ this.selectedDate.set(formatted);
113
+ this.onChange(formatted);
114
+ }
115
+
116
+ onInputTextChange(text: string): void {
117
+ const rawText = text ?? '';
118
+ const normalizedText = this.normalizeToUsDateFormat(rawText);
119
+
120
+ this.selectedDate.set(normalizedText);
121
+
122
+ if (!normalizedText.trim()) {
123
+ this.invalidInput.set(false);
124
+ this.selectedDate.set('');
125
+ this.selectedDateObj.set(null);
126
+ this.onChange('');
127
+ return;
128
+ }
129
+
130
+ const date = this.parseDate(normalizedText);
131
+
132
+ if (date) {
133
+ if (!this.futureDatesAllowed() && this.isFutureDate(date)) {
134
+ this.invalidInput.set(true);
135
+ this.selectedDateObj.set(null);
136
+ this.selectedDate.set('');
137
+ this.onChange('');
138
+ return;
139
+ }
140
+
141
+ this.invalidInput.set(false);
142
+ this.selectedDateObj.set(date);
143
+ const formatted = this.formatDate(date);
144
+ this.selectedDate.set(formatted);
145
+ this.onChange(formatted);
146
+ return;
147
+ }
148
+
149
+ this.invalidInput.set(true);
150
+ this.selectedDateObj.set(null);
151
+ this.onChange(normalizedText);
152
+ }
153
+
154
+ private normalizeToUsDateFormat(text: string): string {
155
+ const digits = text.replace(/\D/g, '');
156
+
157
+ if (this.monthlyPicker()) {
158
+ if (digits.length === 6) {
159
+ return `${digits.slice(0, 2)}/${digits.slice(2, 6)}`;
160
+ }
161
+ return text;
162
+ }
163
+
164
+ if (digits.length === 8) {
165
+ return `${digits.slice(0, 2)}/${digits.slice(2, 4)}/${digits.slice(4, 8)}`;
166
+ }
167
+
168
+ return text;
169
+ }
170
+
171
+ private parseDate(text: string): Date | null {
172
+ const normalized = text.trim();
173
+
174
+ if (this.monthlyPicker()) {
175
+ const monthlyPattern = /^\d{2}\/\d{4}$/;
176
+ if (!monthlyPattern.test(normalized)) return null;
177
+
178
+ const parts = normalized.split('/');
179
+ if (parts.length !== 2) return null;
180
+
181
+ const [monthStr, yearStr] = parts;
182
+ const month = parseInt(monthStr, 10);
183
+ const year = parseInt(yearStr, 10);
184
+
185
+ if (isNaN(month) || isNaN(year)) return null;
186
+ if (month < 1 || month > 12) return null;
187
+
188
+ return new Date(year, month - 1, 1);
189
+ }
190
+
191
+ const strictDatePattern = /^\d{2}\/\d{2}\/\d{4}$/;
192
+ if (!strictDatePattern.test(normalized)) return null;
193
+
194
+ const parts = normalized.split('/');
195
+ if (parts.length !== 3) return null;
196
+
197
+ const [monthStr, dayStr, yearStr] = parts;
198
+ const month = parseInt(monthStr, 10);
199
+ const day = parseInt(dayStr, 10);
200
+ const year = parseInt(yearStr, 10);
201
+
202
+ if (isNaN(month) || isNaN(day) || isNaN(year)) return null;
203
+ if (month < 1 || month > 12 || day < 1 || day > 31) return null;
204
+
205
+ const date = new Date(year, month - 1, day);
206
+ if (date.getMonth() !== month - 1 || date.getDate() !== day) return null;
207
+
208
+ return date;
209
+ }
210
+
211
+ private toDate(value: unknown): Date | null {
212
+ if (!value) return null;
213
+
214
+ if (value instanceof Date) {
215
+ return Number.isNaN(value.getTime()) ? null : value;
216
+ }
217
+
218
+ if (typeof value === 'string') {
219
+ const parsed = this.parseDate(this.normalizeToUsDateFormat(value));
220
+ if (parsed) return parsed;
221
+ if (!this.isIsoDateString(value)) return null;
222
+ const isoDate = new Date(value);
223
+ return Number.isNaN(isoDate.getTime()) ? null : isoDate;
224
+ }
225
+
226
+ if (typeof value === 'object' && value !== null) {
227
+ const maybeWithToDate = value as { toDate?: () => Date };
228
+ if (typeof maybeWithToDate.toDate === 'function') {
229
+ const converted = maybeWithToDate.toDate();
230
+ return Number.isNaN(converted.getTime()) ? null : converted;
231
+ }
232
+
233
+ const maybeWithNativeDate = value as { $d?: Date };
234
+ if (maybeWithNativeDate.$d instanceof Date) {
235
+ return Number.isNaN(maybeWithNativeDate.$d.getTime())
236
+ ? null
237
+ : maybeWithNativeDate.$d;
238
+ }
239
+ }
240
+
241
+ return null;
242
+ }
243
+
244
+ private isIsoDateString(value: string): boolean {
245
+ return /^\d{4}-\d{2}-\d{2}(?:[T\s].*)?$/.test(value.trim());
246
+ }
247
+
248
+ private formatDate(date: Date): string {
249
+ const month = String(date.getMonth() + 1).padStart(2, '0');
250
+ const year = date.getFullYear();
251
+
252
+ if (this.monthlyPicker()) {
253
+ return `${month}/${year}`;
254
+ }
255
+
256
+ const day = String(date.getDate()).padStart(2, '0');
257
+ return `${month}/${day}/${year}`;
258
+ }
259
+
260
+ openDatePicker(): void {
261
+ this.isDatePickerOpen = !this.isDatePickerOpen;
262
+ }
263
+
264
+ onOpenChange(isOpen: boolean): void {
265
+ this.isDatePickerOpen = isOpen;
266
+ }
267
+
268
+ onInputBlur(): void {
269
+ this.onTouched();
270
+ }
271
+
272
+ writeValue(value: unknown): void {
273
+ const date = this.toDate(value);
274
+
275
+ if (date) {
276
+ this.invalidInput.set(false);
277
+ this.selectedDateObj.set(date);
278
+ this.selectedDate.set(this.formatDate(date));
279
+ return;
280
+ }
281
+
282
+ if (typeof value === 'string') {
283
+ const normalizedText = this.normalizeToUsDateFormat(value);
284
+ this.selectedDate.set(normalizedText);
285
+ const parsedDate = this.parseDate(normalizedText);
286
+ this.selectedDateObj.set(parsedDate);
287
+ this.invalidInput.set(normalizedText.trim().length > 0 && !parsedDate);
288
+ return;
289
+ }
290
+
291
+ this.invalidInput.set(false);
292
+ this.selectedDate.set('');
293
+ this.selectedDateObj.set(null);
294
+ }
295
+
296
+ hasVisualError(): boolean {
297
+ return this.hasError() || this.invalidInput();
298
+ }
299
+
300
+ resolvedErrorMessage(): string {
301
+ if (this.hasError()) {
302
+ return this.errorMessage();
303
+ }
304
+
305
+ return this.invalidInput() ? this.errorMessage() : '';
306
+ }
307
+
308
+ registerOnChange(fn: (value: string) => void): void {
309
+ this.onChange = fn;
310
+ }
311
+
312
+ registerOnTouched(fn: () => void): void {
313
+ this.onTouched = fn;
314
+ }
315
+
316
+ setDisabledState(isDisabled: boolean): void {
317
+ this.cvaDisabled = isDisabled;
318
+ }
319
+
320
+ @HostListener('document:click', ['$event'])
321
+ onDocumentClick(event: MouseEvent): void {
322
+ if (!this.isDatePickerOpen) {
323
+ return;
324
+ }
325
+
326
+ const target = event.target as HTMLElement;
327
+ const containerElement = this.elementRef?.nativeElement;
328
+
329
+ if (target instanceof Element && containerElement?.contains(target)) {
330
+ return;
331
+ }
332
+
333
+ if (target instanceof Element && target.closest('.cdk-overlay-pane')) {
334
+ return;
335
+ }
336
+
337
+ this.isDatePickerOpen = false;
338
+ }
339
+
340
+ disabledDate = (current: Date): boolean => {
341
+ if (this.futureDatesAllowed()) return false;
342
+ return this.isFutureDate(current);
343
+ };
344
+
345
+ private isFutureDate(date: Date): boolean {
346
+ const today = new Date();
347
+ today.setHours(0, 0, 0, 0);
348
+
349
+ const comparedDate = new Date(date);
350
+ comparedDate.setHours(0, 0, 0, 0);
351
+
352
+ return comparedDate.getTime() > today.getTime();
353
+ }
354
+
355
+ constructor(private elementRef: ElementRef) {}
356
+ }
@@ -0,0 +1,69 @@
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()"
8
+ [disabled]="isDisabled()"
9
+ [placeholder]="datePickerPlaceholder()"
10
+ [ngModel]="selectedDate()"
11
+ (ngModelChange)="onInputTextChange($event)"
12
+ (blur)="onInputBlur()"
13
+ [mask]="monthlyPicker() ? '00/0000' : '00/00/0000'"
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
+ @if (!monthlyPicker()) {
33
+ <nz-date-picker
34
+ style="position: absolute"
35
+ class="opacity-0 pointer-events-none w-full h-full left-0 top-0"
36
+ #datePicker
37
+ [ngModel]="selectedDateObj()"
38
+ [nzDisabled]="isDisabled()"
39
+ [nzDisabledDate]="disabledDate"
40
+ [nzOpen]="isDatePickerOpen"
41
+ [nzPlaceHolder]="datePickerPlaceholder()"
42
+ [nzPlacement]="'bottomRight'"
43
+ [nzFormat]="'MM/dd/yyyy'"
44
+ (ngModelChange)="onInputValue($event)"
45
+ (nzOnOpenChange)="onOpenChange($event)"
46
+ ></nz-date-picker>
47
+ } @else {
48
+ <nz-month-picker
49
+ style="position: absolute"
50
+ class="opacity-0 pointer-events-none w-full h-full left-0 top-0"
51
+ #datePicker
52
+ [ngModel]="selectedDateObj()"
53
+ [nzDisabled]="isDisabled()"
54
+ [nzDisabledDate]="disabledDate"
55
+ [nzOpen]="isDatePickerOpen"
56
+ [nzPlaceHolder]="datePickerPlaceholder()"
57
+ [nzPlacement]="'bottomRight'"
58
+ [nzFormat]="'MM/yyyy'"
59
+ (ngModelChange)="onInputValue($event)"
60
+ (nzOnOpenChange)="onOpenChange($event)"
61
+ ></nz-month-picker>
62
+ }
63
+ </div>
64
+
65
+ <ads-error-message
66
+ [hasError]="hasVisualError()"
67
+ [errorMessage]="resolvedErrorMessage()"
68
+ ></ads-error-message>
69
+ </div>
@@ -0,0 +1,99 @@
1
+ import { Meta, StoryObj } from '@storybook/angular';
2
+ import { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms';
3
+ import { InputDatepickerComponent } from './input-datepicker.component';
4
+
5
+ type InputDatepickerProps = InputDatepickerComponent;
6
+
7
+ const meta: Meta<InputDatepickerProps> = {
8
+ title: 'Components/Input Datepicker',
9
+ component: InputDatepickerComponent,
10
+ argTypes: {
11
+ label: { control: 'text' },
12
+ datePickerPlaceholder: { control: 'text' },
13
+ hasError: { control: 'boolean' },
14
+ isPickerDisabled: { control: 'boolean' },
15
+ futureDatesAllowed: { control: 'boolean' },
16
+ monthlyPicker: { control: 'boolean' },
17
+ },
18
+ render: (args) => ({
19
+ props: args,
20
+ template: `
21
+ <div class="w-100">
22
+ <ads-input-datepicker
23
+ [label]="label"
24
+ [datePickerPlaceholder]="datePickerPlaceholder"
25
+ [hasError]="hasError"
26
+ [isPickerDisabled]="isPickerDisabled"
27
+ [futureDatesAllowed]="futureDatesAllowed"
28
+ [monthlyPicker]="monthlyPicker"
29
+ ></ads-input-datepicker>
30
+ </div>
31
+ `,
32
+ }),
33
+ };
34
+
35
+ export default meta;
36
+ type Story = StoryObj<InputDatepickerProps>;
37
+
38
+ export const Playground: Story = {
39
+ args: {
40
+ label: 'Date',
41
+ datePickerPlaceholder: 'MM/DD/YYYY',
42
+ hasError: false,
43
+ isPickerDisabled: false,
44
+ futureDatesAllowed: false,
45
+ monthlyPicker: false,
46
+ },
47
+ };
48
+
49
+ export const MonthlyPicker: Story = {
50
+ args: {
51
+ label: 'Month',
52
+ datePickerPlaceholder: 'MM/YYYY',
53
+ hasError: false,
54
+ isPickerDisabled: false,
55
+ futureDatesAllowed: false,
56
+ monthlyPicker: true,
57
+ },
58
+ };
59
+
60
+ export const ReactiveForms: Story = {
61
+ args: {
62
+ label: 'Date',
63
+ datePickerPlaceholder: 'MM/DD/YYYY',
64
+ hasError: false,
65
+ isPickerDisabled: false,
66
+ futureDatesAllowed: false,
67
+ monthlyPicker: false,
68
+ },
69
+ render: (args) => {
70
+ const form = new FormGroup({
71
+ date: new FormControl(''),
72
+ });
73
+
74
+ return {
75
+ moduleMetadata: {
76
+ imports: [ReactiveFormsModule],
77
+ },
78
+ props: {
79
+ ...args,
80
+ form,
81
+ },
82
+ template: `
83
+ <div class="w-100">
84
+ <form [formGroup]="form">
85
+ <ads-input-datepicker
86
+ formControlName="date"
87
+ [label]="label"
88
+ [datePickerPlaceholder]="datePickerPlaceholder"
89
+ [hasError]="hasError"
90
+ [isPickerDisabled]="isPickerDisabled"
91
+ [futureDatesAllowed]="futureDatesAllowed"
92
+ [monthlyPicker]="monthlyPicker"
93
+ ></ads-input-datepicker>
94
+ </form>
95
+ </div>
96
+ `,
97
+ };
98
+ },
99
+ };