@aaamb/ngx-design-system 1.3.5 → 1.3.6

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 +69 -0
  37. package/src/components/datepicker-selector/datepicker-selector.component.ts +287 -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 +1333 -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 +157 -0
  86. package/src/components/side-nav/side-nav.component.ts +306 -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 +441 -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 +486 -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 -4024
  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 -1132
@@ -0,0 +1,365 @@
1
+ import {
2
+ Component,
3
+ ElementRef,
4
+ forwardRef,
5
+ HostListener,
6
+ input,
7
+ signal,
8
+ } from '@angular/core';
9
+ import { CommonModule } from '@angular/common';
10
+ import {
11
+ ControlValueAccessor,
12
+ FormsModule,
13
+ NG_VALUE_ACCESSOR,
14
+ } from '@angular/forms';
15
+ import { NzDatePickerModule } from 'ng-zorro-antd/date-picker';
16
+ import { NgxMaskDirective, provideNgxMask } from 'ngx-mask';
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
+ selector: 'ads-input-rangepicker',
23
+ imports: [
24
+ CommonModule,
25
+ FormsModule,
26
+ NzDatePickerModule,
27
+ NgxMaskDirective,
28
+ IconComponent,
29
+ LabelComponent,
30
+ ErrorMessageComponent,
31
+ ],
32
+ templateUrl: './input-rangepicker.html',
33
+ providers: [
34
+ provideNgxMask(),
35
+ {
36
+ provide: NG_VALUE_ACCESSOR,
37
+ useExisting: forwardRef(() => InputRangepickerComponent),
38
+ multi: true,
39
+ },
40
+ ],
41
+ })
42
+ export class InputRangepickerComponent implements ControlValueAccessor {
43
+ isPickerDisabled = input<boolean>(false);
44
+ rangePickerPlaceholder = input<string>('MM/DD/YYYY - MM/DD/YYYY');
45
+ hasError = input<boolean>(false);
46
+ errorMessage = input<string>('Please enter a valid date range.');
47
+ label = input<string>('');
48
+ allowFutureDates = input<boolean>(false);
49
+
50
+ isDatePickerOpen = false;
51
+ selectedRange = signal<string>('');
52
+ selectedRangeObj = signal<[Date, Date] | null>(null);
53
+ invalidInput = signal<boolean>(false);
54
+
55
+ private cvaDisabled = false;
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
+ constructor(private elementRef: ElementRef) {}
63
+
64
+ isDisabled(): boolean {
65
+ return this.isPickerDisabled() || this.cvaDisabled;
66
+ }
67
+
68
+ activeInputClass(): string {
69
+ return 'hover:border-aqua-2 focus:border-aqua-2';
70
+ }
71
+
72
+ errorActiveClass(): string {
73
+ return 'hover:border-red-1 focus:border-red-1';
74
+ }
75
+
76
+ inputStateClass(): string {
77
+ if (this.isDisabled()) {
78
+ return `${this.basicClass} border-neutral-disabled-bg bg-neutral-disabled-bg text-neutral-disabled-text placeholder:neutral-disabled-text cursor-default`;
79
+ }
80
+
81
+ if (this.hasError()) {
82
+ return `${this.basicClass} ${this.errorActiveClass()} border-red-3 bg-red-6 text-green-base`;
83
+ }
84
+
85
+ return `${this.basicClass} ${this.activeInputClass()} border-aqua-5 bg-aqua-6 focus:border-primary text-green-base`;
86
+ }
87
+
88
+ openDatePicker(): void {
89
+ if (!this.isDisabled()) {
90
+ this.isDatePickerOpen = !this.isDatePickerOpen;
91
+ }
92
+ }
93
+
94
+ onOpenChange(isOpen: boolean): void {
95
+ this.isDatePickerOpen = isOpen;
96
+ }
97
+
98
+ onInputBlur(): void {
99
+ this.onTouched();
100
+ }
101
+
102
+ onRangeValue(value: unknown): void {
103
+ const parsed = this.toDateRange(value);
104
+
105
+ if (!parsed) {
106
+ this.invalidInput.set(true);
107
+ this.selectedRangeObj.set(null);
108
+ this.selectedRange.set('');
109
+ this.onChange('');
110
+ return;
111
+ }
112
+
113
+ const [start, end] = parsed;
114
+
115
+ if (!this.allowFutureDates() && this.hasFutureDateInRange([start, end])) {
116
+ this.invalidInput.set(true);
117
+ this.selectedRangeObj.set(null);
118
+ this.selectedRange.set('');
119
+ this.onChange('');
120
+ return;
121
+ }
122
+
123
+ this.invalidInput.set(false);
124
+ const formatted = `${this.formatDate(start)} - ${this.formatDate(end)}`;
125
+ this.selectedRangeObj.set([start, end]);
126
+ this.selectedRange.set(formatted);
127
+ this.onChange(formatted);
128
+ }
129
+
130
+ onInputTextChange(text: string): void {
131
+ const rawText = text ?? '';
132
+ const normalizedText = this.normalizeToUsRangeFormat(rawText);
133
+ this.selectedRange.set(normalizedText);
134
+
135
+ if (!normalizedText.trim()) {
136
+ this.invalidInput.set(false);
137
+ this.selectedRange.set('');
138
+ this.selectedRangeObj.set(null);
139
+ this.onChange('');
140
+ return;
141
+ }
142
+
143
+ const parsed = this.parseRange(normalizedText);
144
+ if (parsed) {
145
+ const [start, end] = parsed;
146
+
147
+ if (!this.allowFutureDates() && this.hasFutureDateInRange([start, end])) {
148
+ this.invalidInput.set(true);
149
+ this.selectedRangeObj.set(null);
150
+ this.selectedRange.set('');
151
+ this.onChange('');
152
+ return;
153
+ }
154
+
155
+ this.invalidInput.set(false);
156
+ const formatted = `${this.formatDate(start)} - ${this.formatDate(end)}`;
157
+ this.selectedRangeObj.set([start, end]);
158
+ this.selectedRange.set(formatted);
159
+ this.onChange(formatted);
160
+ return;
161
+ }
162
+
163
+ this.invalidInput.set(true);
164
+ this.selectedRangeObj.set(null);
165
+ this.onChange(normalizedText);
166
+ }
167
+
168
+ writeValue(value: unknown): void {
169
+ const parsed = this.toDateRange(value);
170
+
171
+ if (parsed) {
172
+ const [start, end] = parsed;
173
+ this.invalidInput.set(false);
174
+ this.selectedRangeObj.set([start, end]);
175
+ this.selectedRange.set(
176
+ `${this.formatDate(start)} - ${this.formatDate(end)}`,
177
+ );
178
+ return;
179
+ }
180
+
181
+ if (typeof value === 'string') {
182
+ const normalizedText = this.normalizeToUsRangeFormat(value);
183
+ this.selectedRange.set(normalizedText);
184
+ const parsedRange = this.parseRange(normalizedText);
185
+ this.selectedRangeObj.set(parsedRange);
186
+ this.invalidInput.set(normalizedText.trim().length > 0 && !parsedRange);
187
+ return;
188
+ }
189
+
190
+ this.invalidInput.set(false);
191
+ this.selectedRange.set('');
192
+ this.selectedRangeObj.set(null);
193
+ }
194
+
195
+ hasVisualError(): boolean {
196
+ return this.hasError() || this.invalidInput();
197
+ }
198
+
199
+ resolvedErrorMessage(): string {
200
+ if (this.hasError()) {
201
+ return this.errorMessage();
202
+ }
203
+
204
+ return this.invalidInput() ? this.errorMessage() : '';
205
+ }
206
+
207
+ registerOnChange(fn: (value: string) => void): void {
208
+ this.onChange = fn;
209
+ }
210
+
211
+ registerOnTouched(fn: () => void): void {
212
+ this.onTouched = fn;
213
+ }
214
+
215
+ setDisabledState(isDisabled: boolean): void {
216
+ this.cvaDisabled = isDisabled;
217
+ }
218
+
219
+ @HostListener('document:click', ['$event'])
220
+ onDocumentClick(event: MouseEvent): void {
221
+ if (!this.isDatePickerOpen) {
222
+ return;
223
+ }
224
+
225
+ const target = event.target as HTMLElement;
226
+ const containerElement = this.elementRef?.nativeElement;
227
+
228
+ if (containerElement && containerElement.contains(target)) {
229
+ return;
230
+ }
231
+
232
+ const overlayPane = document.querySelector('.cdk-overlay-pane');
233
+ if (overlayPane && overlayPane.contains(target)) {
234
+ return;
235
+ }
236
+
237
+ this.isDatePickerOpen = false;
238
+ }
239
+
240
+ disabledDate = (current: Date): boolean => {
241
+ if (this.allowFutureDates()) return false;
242
+ return this.isFutureDate(current);
243
+ };
244
+
245
+ private normalizeToUsRangeFormat(text: string): string {
246
+ const digits = text.replace(/\D/g, '');
247
+
248
+ if (digits.length === 16) {
249
+ 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)}`;
250
+ }
251
+
252
+ return text;
253
+ }
254
+
255
+ private parseRange(text: string): [Date, Date] | null {
256
+ const normalized = text.trim();
257
+ const strictRangePattern = /^\d{2}\/\d{2}\/\d{4}\s-\s\d{2}\/\d{2}\/\d{4}$/;
258
+
259
+ if (!strictRangePattern.test(normalized)) return null;
260
+
261
+ const [startText, endText] = normalized.split(' - ');
262
+ const start = this.parseDate(startText);
263
+ const end = this.parseDate(endText);
264
+
265
+ if (!start || !end) return null;
266
+
267
+ return [start, end];
268
+ }
269
+
270
+ private toDateRange(value: unknown): [Date, Date] | null {
271
+ if (!value) return null;
272
+
273
+ if (Array.isArray(value) && value.length === 2) {
274
+ const start = this.toDate(value[0]);
275
+ const end = this.toDate(value[1]);
276
+
277
+ if (!start || !end) return null;
278
+
279
+ return [start, end];
280
+ }
281
+
282
+ if (typeof value === 'string') {
283
+ return this.parseRange(value);
284
+ }
285
+
286
+ return null;
287
+ }
288
+
289
+ private parseDate(text: string): Date | null {
290
+ const normalized = text.trim();
291
+ const strictDatePattern = /^\d{2}\/\d{2}\/\d{4}$/;
292
+
293
+ if (!strictDatePattern.test(normalized)) return null;
294
+
295
+ const parts = normalized.split('/');
296
+ if (parts.length !== 3) return null;
297
+
298
+ const [monthStr, dayStr, yearStr] = parts;
299
+ const month = parseInt(monthStr, 10);
300
+ const day = parseInt(dayStr, 10);
301
+ const year = parseInt(yearStr, 10);
302
+
303
+ if (isNaN(month) || isNaN(day) || isNaN(year)) return null;
304
+ if (month < 1 || month > 12 || day < 1 || day > 31) return null;
305
+
306
+ const date = new Date(year, month - 1, day);
307
+ if (date.getMonth() !== month - 1 || date.getDate() !== day) return null;
308
+
309
+ return date;
310
+ }
311
+
312
+ private toDate(value: unknown): Date | null {
313
+ if (!value) return null;
314
+
315
+ if (value instanceof Date) {
316
+ return Number.isNaN(value.getTime()) ? null : value;
317
+ }
318
+
319
+ if (typeof value === 'string') {
320
+ const parsed = this.parseDate(value);
321
+ if (parsed) return parsed;
322
+ const isoDate = new Date(value);
323
+ return Number.isNaN(isoDate.getTime()) ? null : isoDate;
324
+ }
325
+
326
+ if (typeof value === 'object' && value !== null) {
327
+ const maybeWithToDate = value as { toDate?: () => Date };
328
+ if (typeof maybeWithToDate.toDate === 'function') {
329
+ const converted = maybeWithToDate.toDate();
330
+ return Number.isNaN(converted.getTime()) ? null : converted;
331
+ }
332
+
333
+ const maybeWithNativeDate = value as { $d?: Date };
334
+ if (maybeWithNativeDate.$d instanceof Date) {
335
+ return Number.isNaN(maybeWithNativeDate.$d.getTime())
336
+ ? null
337
+ : maybeWithNativeDate.$d;
338
+ }
339
+ }
340
+
341
+ return null;
342
+ }
343
+
344
+ private formatDate(date: Date): string {
345
+ const month = String(date.getMonth() + 1).padStart(2, '0');
346
+ const day = String(date.getDate()).padStart(2, '0');
347
+ const year = date.getFullYear();
348
+ return `${month}/${day}/${year}`;
349
+ }
350
+
351
+ private isFutureDate(date: Date): boolean {
352
+ const today = new Date();
353
+ today.setHours(0, 0, 0, 0);
354
+
355
+ const comparedDate = new Date(date);
356
+ comparedDate.setHours(0, 0, 0, 0);
357
+
358
+ return comparedDate.getTime() > today.getTime();
359
+ }
360
+
361
+ private hasFutureDateInRange(range: [Date, Date]): boolean {
362
+ const [start, end] = range;
363
+ return this.isFutureDate(start) || this.isFutureDate(end);
364
+ }
365
+ }
@@ -0,0 +1,54 @@
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 min-w-65">
5
+ <input
6
+ type="text"
7
+ [class]="inputStateClass() + ' pr-12'"
8
+ [disabled]="isDisabled()"
9
+ [placeholder]="rangePickerPlaceholder()"
10
+ [ngModel]="selectedRange()"
11
+ (ngModelChange)="onInputTextChange($event)"
12
+ (blur)="onInputBlur()"
13
+ [mask]="'00/00/0000 - 00/00/0000'"
14
+ />
15
+
16
+ <button
17
+ type="button"
18
+ [disabled]="isDisabled()"
19
+ (click)="openDatePicker()"
20
+ 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"
21
+ >
22
+ <ads-icon
23
+ [ngClass]="{
24
+ 'cursor-pointer': !isDisabled(),
25
+ 'text-green-1': !hasVisualError() && !isDisabled(),
26
+ 'text-red-2': hasVisualError(),
27
+ 'text-gray-500': isDisabled(),
28
+ }"
29
+ [iconName]="'calendar'"
30
+ [size]="24"
31
+ ></ads-icon>
32
+ </button>
33
+
34
+ <nz-range-picker
35
+ style="position: absolute"
36
+ class="opacity-0 pointer-events-none w-full h-full left-0 top-0"
37
+ [ngModel]="selectedRangeObj()"
38
+ [nzDisabled]="isDisabled()"
39
+ [nzDisabledDate]="disabledDate"
40
+ [nzOpen]="isDatePickerOpen"
41
+ [nzPlaceHolder]="[rangePickerPlaceholder(), rangePickerPlaceholder()]"
42
+ nzDropdownClassName="ads-input-rangepicker-dropdown"
43
+ [nzPlacement]="'bottomLeft'"
44
+ [nzFormat]="'MM/dd/yyyy'"
45
+ (ngModelChange)="onRangeValue($event)"
46
+ (nzOnOpenChange)="onOpenChange($event)"
47
+ ></nz-range-picker>
48
+ </div>
49
+
50
+ <ads-error-message
51
+ [hasError]="hasVisualError()"
52
+ [errorMessage]="resolvedErrorMessage()"
53
+ ></ads-error-message>
54
+ </div>
@@ -0,0 +1,88 @@
1
+ import { Meta, StoryObj } from '@storybook/angular';
2
+ import { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms';
3
+ import { InputRangepickerComponent } from './input-rangepicker.component';
4
+
5
+ type InputRangepickerProps = InputRangepickerComponent;
6
+
7
+ const meta: Meta<InputRangepickerProps> = {
8
+ title: 'Components/Input Rangepicker',
9
+ component: InputRangepickerComponent,
10
+ argTypes: {
11
+ label: { control: 'text' },
12
+ rangePickerPlaceholder: { control: 'text' },
13
+ hasError: { control: 'boolean' },
14
+ errorMessage: { control: 'text' },
15
+ isPickerDisabled: { control: 'boolean' },
16
+ allowFutureDates: { control: 'boolean' },
17
+ },
18
+ render: (args) => ({
19
+ props: args,
20
+ template: `
21
+ <div class="w-100">
22
+ <ads-input-rangepicker
23
+ [label]="label"
24
+ [rangePickerPlaceholder]="rangePickerPlaceholder"
25
+ [hasError]="hasError"
26
+ [errorMessage]="errorMessage"
27
+ [isPickerDisabled]="isPickerDisabled"
28
+ [allowFutureDates]="allowFutureDates"
29
+ ></ads-input-rangepicker>
30
+ </div>
31
+ `,
32
+ }),
33
+ };
34
+
35
+ export default meta;
36
+ type Story = StoryObj<InputRangepickerProps>;
37
+
38
+ export const Playground: Story = {
39
+ args: {
40
+ label: 'Date range',
41
+ rangePickerPlaceholder: 'MM/DD/YYYY - MM/DD/YYYY',
42
+ hasError: false,
43
+ errorMessage: 'Please enter a valid date range.',
44
+ isPickerDisabled: false,
45
+ allowFutureDates: false,
46
+ },
47
+ };
48
+
49
+ export const ReactiveForms: Story = {
50
+ args: {
51
+ label: 'Date range',
52
+ rangePickerPlaceholder: 'MM/DD/YYYY - MM/DD/YYYY',
53
+ hasError: false,
54
+ errorMessage: 'Please enter a valid date range.',
55
+ isPickerDisabled: false,
56
+ allowFutureDates: false,
57
+ },
58
+ render: (args) => {
59
+ const form = new FormGroup({
60
+ dateRange: new FormControl(''),
61
+ });
62
+
63
+ return {
64
+ moduleMetadata: {
65
+ imports: [ReactiveFormsModule],
66
+ },
67
+ props: {
68
+ ...args,
69
+ form,
70
+ },
71
+ template: `
72
+ <div class="w-100">
73
+ <form [formGroup]="form">
74
+ <ads-input-rangepicker
75
+ formControlName="dateRange"
76
+ [label]="label"
77
+ [rangePickerPlaceholder]="rangePickerPlaceholder"
78
+ [hasError]="hasError"
79
+ [errorMessage]="errorMessage"
80
+ [isPickerDisabled]="isPickerDisabled"
81
+ [allowFutureDates]="allowFutureDates"
82
+ ></ads-input-rangepicker>
83
+ </form>
84
+ </div>
85
+ `,
86
+ };
87
+ },
88
+ };