cats-ui-lib 2.0.4 โ†’ 2.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,63 +1,799 @@
1
- # CatsUi
1
+ # cats-ui-lib
2
2
 
3
- This project was generated using [Angular CLI](https://github.com/angular/angular-cli) version 19.2.0.
3
+ A comprehensive Angular UI component library built with Angular 19, providing a rich set of reusable, customizable components for modern web applications.
4
4
 
5
- ## Code scaffolding
5
+ [![npm version](https://img.shields.io/npm/v/cats-ui-lib.svg)](https://www.npmjs.com/package/cats-ui-lib)
6
+ [![Angular](https://img.shields.io/badge/Angular-19-red.svg)](https://angular.dev)
6
7
 
7
- Angular CLI includes powerful code scaffolding tools. To generate a new component, run:
8
+ ---
9
+
10
+ ## ๐Ÿ“ฆ Installation
8
11
 
9
12
  ```bash
10
- ng generate component component-name
13
+ npm install cats-ui-lib
11
14
  ```
12
15
 
13
- For a complete list of available schematics (such as `components`, `directives`, or `pipes`), run:
16
+ ---
14
17
 
15
- ```bash
16
- ng generate --help
18
+ ## โš™๏ธ Setup
19
+
20
+ ### 1. Configure `angular.json`
21
+
22
+ Add the following inside the `build > options` section of your `angular.json`:
23
+
24
+ ```json
25
+ "assets": [
26
+ {
27
+ "glob": "**/*",
28
+ "input": "node_modules/cats-ui/assets"
29
+ }
30
+ ],
31
+ "styles": [
32
+ "node_modules/cats-ui-lib/styles/_index.scss"
33
+ ]
17
34
  ```
18
35
 
19
- ## Building
36
+ ### 2. Import the Module
20
37
 
21
- To build the library, run:
38
+ ```typescript
39
+ import { CatsUiModule } from 'cats-ui-lib';
22
40
 
23
- ```bash
24
- ng build cats-ui
41
+ @NgModule({
42
+ imports: [CatsUiModule],
43
+ })
44
+ export class AppModule {}
45
+ ```
46
+
47
+ ---
48
+
49
+ ## ๐Ÿงฉ Components
50
+
51
+ ---
52
+
53
+ ### `InputComponent` โ€” `<cats-ui-input>`
54
+
55
+ Supports types: `text` ยท `number` ยท `email` ยท `password`
56
+
57
+ **Template:**
58
+ ```html
59
+ <cats-ui-input
60
+ [inputConfig]="inputConfig"
61
+ [(ngModel)]="name"
62
+ required>
63
+ </cats-ui-input>
64
+
65
+ <!-- Disabled state -->
66
+ <cats-ui-input
67
+ [disabled]="true"
68
+ [inputConfig]="inputConfig"
69
+ [(ngModel)]="name">
70
+ </cats-ui-input>
71
+ ```
72
+
73
+ **TypeScript:**
74
+ ```typescript
75
+ import { InputConfig } from 'cats-ui-lib';
76
+
77
+ inputConfig: InputConfig = {
78
+ type: 'text',
79
+ placeholder: 'Enter value',
80
+ };
81
+ ```
82
+
83
+ **`InputConfig` options:**
84
+
85
+ | Property | Type | Description |
86
+ |---------------|----------|--------------------------------------------------|
87
+ | `type` | `string` | Input type: `text`, `email`, `password`, `number`|
88
+ | `placeholder` | `string` | Placeholder text |
89
+
90
+ ---
91
+
92
+ ### `SingleSelectComponent` โ€” `<cats-ui-single-select>`
93
+
94
+ **Template:**
95
+ ```html
96
+ <cats-ui-single-select
97
+ [optionList]="options"
98
+ [singleSelectConfig]="singleConfig"
99
+ [parentNativeElement]="'parent'"
100
+ (onSelection)="onSelection($event)">
101
+ </cats-ui-single-select>
102
+ ```
103
+
104
+ **TypeScript:**
105
+ ```typescript
106
+ import { SingleSelectConfig } from 'cats-ui-lib';
107
+
108
+ options = [
109
+ { id: 1, name: 'Option 1', disable: false },
110
+ { id: 2, name: 'Option 2', disable: false },
111
+ ];
112
+
113
+ singleConfig: SingleSelectConfig = {
114
+ idField: 'id',
115
+ textField: 'name',
116
+ disabledField: 'disable',
117
+ placeholder: 'Select Option',
118
+ };
119
+
120
+ onSelection(dt: any) {
121
+ console.log('Selected:', dt);
122
+ }
123
+ ```
124
+
125
+ **`SingleSelectConfig` options:**
126
+
127
+ | Property | Type | Description |
128
+ |-----------------|----------|------------------------------------|
129
+ | `idField` | `string` | Key for option ID |
130
+ | `textField` | `string` | Key for display label |
131
+ | `disabledField` | `string` | Key to mark option as disabled |
132
+ | `placeholder` | `string` | Placeholder text |
133
+
134
+ ---
135
+
136
+ ### `MultiSelectComponent` โ€” `<cats-ui-multi-select>`
137
+
138
+ **Template:**
139
+ ```html
140
+ <cats-ui-multi-select
141
+ [optionList]="options"
142
+ [multiSelectConfig]="multiSelectConfig"
143
+ (onSelection)="onSelection($event)">
144
+ </cats-ui-multi-select>
145
+ ```
146
+
147
+ **TypeScript:**
148
+ ```typescript
149
+ import { MultiSelectConfig } from 'cats-ui-lib';
150
+
151
+ multiSelectConfig: MultiSelectConfig = {
152
+ idField: 'id',
153
+ textField: 'name',
154
+ disabledField: 'disable',
155
+ placeholder: 'Select Option',
156
+ prefixLabel: '',
157
+ enableSearch: true,
158
+ chipLimit: 2,
159
+ selectAll: true,
160
+ required: false,
161
+ };
162
+ ```
163
+
164
+ **`MultiSelectConfig` options:**
165
+
166
+ | Property | Type | Description |
167
+ |-----------------|-----------|----------------------------------------------|
168
+ | `idField` | `string` | Key for option ID |
169
+ | `textField` | `string` | Key for display label |
170
+ | `disabledField` | `string` | Key to mark option as disabled |
171
+ | `placeholder` | `string` | Placeholder text |
172
+ | `prefixLabel` | `string` | Label prefix shown before selected chips |
173
+ | `enableSearch` | `boolean` | Show search input inside dropdown |
174
+ | `chipLimit` | `number` | Max chips to display before `+N more` |
175
+ | `selectAll` | `boolean` | Show "Select All" option |
176
+ | `required` | `boolean` | Mark field as required |
177
+
178
+ ---
179
+
180
+ ### `AutoComplete SingleSelect` โ€” `<cats-ui-input-single-select>`
181
+
182
+ **Template:**
183
+ ```html
184
+ <cats-ui-input-single-select
185
+ [optionsList]="options"
186
+ [autoSingleSelectConfig]="autoSingleSelectConfig"
187
+ (onItemSelection)="onSelection($event)">
188
+ </cats-ui-input-single-select>
189
+ ```
190
+
191
+ **TypeScript:**
192
+ ```typescript
193
+ import { AutoCompleteSingleSelectConfig } from 'cats-ui-lib';
194
+
195
+ autoSingleSelectConfig: AutoCompleteSingleSelectConfig = {
196
+ idField: 'id',
197
+ textField: 'name',
198
+ disabledField: '',
199
+ placeholder: 'Enter or select',
200
+ required: false,
201
+ customInput: true,
202
+ };
203
+ ```
204
+
205
+ **`AutoCompleteSingleSelectConfig` options:**
206
+
207
+ | Property | Type | Description |
208
+ |-----------------|-----------|------------------------------------------|
209
+ | `idField` | `string` | Key for option ID |
210
+ | `textField` | `string` | Key for display label |
211
+ | `disabledField` | `string` | Key to mark option as disabled |
212
+ | `placeholder` | `string` | Placeholder text |
213
+ | `required` | `boolean` | Mark field as required |
214
+ | `customInput` | `boolean` | Allow free-text input not in option list |
215
+
216
+ ---
217
+
218
+ ### `AutoComplete MultiSelect` โ€” `<cats-ui-input-multi-select>`
219
+
220
+ **Template:**
221
+ ```html
222
+ <cats-ui-input-multi-select
223
+ [optionsList]="options"
224
+ [autoCompleteMultiSelectConfig]="autoMultiSelectConfig"
225
+ (onItemSelection)="onSelection($event)">
226
+ </cats-ui-input-multi-select>
227
+ ```
228
+
229
+ **TypeScript:**
230
+ ```typescript
231
+ import { AutoCompleteMultiSelectConfig } from 'cats-ui-lib';
232
+
233
+ autoMultiSelectConfig: AutoCompleteMultiSelectConfig = {
234
+ idField: 'id',
235
+ textField: 'name',
236
+ disabledField: 'disable',
237
+ placeholder: 'Type to Search',
238
+ selectAll: false,
239
+ chipLimit: 2,
240
+ customInput: false,
241
+ infoText: 'Select any 8 KPIs',
242
+ selectionLimit: 5,
243
+ };
244
+ ```
245
+
246
+ **`AutoCompleteMultiSelectConfig` options:**
247
+
248
+ | Property | Type | Description |
249
+ |------------------|-----------|------------------------------------------|
250
+ | `idField` | `string` | Key for option ID |
251
+ | `textField` | `string` | Key for display label |
252
+ | `disabledField` | `string` | Key to mark option as disabled |
253
+ | `placeholder` | `string` | Placeholder text (supports HTML) |
254
+ | `selectAll` | `boolean` | Show "Select All" option |
255
+ | `chipLimit` | `number` | Max chips shown before `+N more` |
256
+ | `customInput` | `boolean` | Allow free-text input |
257
+ | `infoText` | `string` | Helper text shown below the input |
258
+ | `selectionLimit` | `number` | Max number of items that can be selected |
259
+
260
+ ---
261
+
262
+ ### `SearchBoxComponent` โ€” `<cats-ui-search-box>`
263
+
264
+ **Template:**
265
+ ```html
266
+ <cats-ui-search-box
267
+ [searchConfig]="searchConfig"
268
+ (searchParamValue)="searchParamValue($event)">
269
+ </cats-ui-search-box>
270
+ ```
271
+
272
+ **TypeScript:**
273
+ ```typescript
274
+ import { SearchConfig } from 'cats-ui-lib';
275
+
276
+ searchConfig: SearchConfig = {
277
+ serachValue: '',
278
+ placeholder: 'Search Here',
279
+ };
280
+
281
+ searchParamValue(data: any) {
282
+ console.log('searchParamValue', data);
283
+ }
284
+ ```
285
+
286
+ ---
287
+
288
+ ### `AccordionComponent` โ€” `<cats-ui-accordion>`
289
+
290
+ **Template:**
291
+ ```html
292
+ <cats-ui-accordion>
293
+ <cats-ui-accordion-item title="Panel 1" [index]="0">
294
+ <ng-template>
295
+ <p>Content for Panel 1.</p>
296
+ </ng-template>
297
+ </cats-ui-accordion-item>
298
+
299
+ <cats-ui-accordion-item title="Panel 2" [index]="1">
300
+ <ng-template>
301
+ <p>Content for Panel 2.</p>
302
+ </ng-template>
303
+ </cats-ui-accordion-item>
304
+ </cats-ui-accordion>
305
+ ```
306
+
307
+ ---
308
+
309
+ ### `RadioButtonComponent` โ€” `<cats-ui-radio-button>`
310
+
311
+ **Template:**
312
+ ```html
313
+ <cats-ui-radio-button
314
+ [config]="radioConfig"
315
+ [optionList]="options"
316
+ (selectionChange)="onRadio($event)">
317
+ </cats-ui-radio-button>
318
+ ```
319
+
320
+ **TypeScript:**
321
+ ```typescript
322
+ import { RadioButtonConfig } from 'cats-ui-lib';
323
+
324
+ radioConfig: RadioButtonConfig = {
325
+ valueField: 'id',
326
+ textField: 'name',
327
+ name: 'gender',
328
+ disabled: 'disable',
329
+ };
330
+
331
+ options = [
332
+ { id: 1, name: 'Option 1', disable: false },
333
+ { id: 2, name: 'Option 2', disable: false },
334
+ ];
335
+
336
+ onRadio(data: any) {
337
+ console.log('radio', data);
338
+ }
339
+ ```
340
+
341
+ **`RadioButtonConfig` options:**
342
+
343
+ | Property | Type | Description |
344
+ |---------------|----------|------------------------------------|
345
+ | `valueField` | `string` | Key for option value |
346
+ | `textField` | `string` | Key for display label |
347
+ | `name` | `string` | HTML radio group name |
348
+ | `disabled` | `string` | Key to mark an option as disabled |
349
+
350
+ ---
351
+
352
+ ### `CheckboxComponent` โ€” `<cats-ui-checkbox-button>`
353
+
354
+ **Template:**
355
+ ```html
356
+ <cats-ui-checkbox-button
357
+ [checkBoxConfig]="checkBoxConfig"
358
+ [optionList]="taskOptions"
359
+ (onCheckBoxSelection)="checkBox($event)">
360
+ </cats-ui-checkbox-button>
361
+ ```
362
+
363
+ **TypeScript:**
364
+ ```typescript
365
+ import { CheckBoxConfig } from 'cats-ui-lib';
366
+
367
+ checkBoxConfig: CheckBoxConfig = {
368
+ idField: 'id',
369
+ textField: 'name',
370
+ name: 'check23',
371
+ disabledField: 'disable',
372
+ };
373
+
374
+ taskOptions = [
375
+ { id: '101', name: 'Parent Task 1', disable: true },
376
+ { id: '102', name: 'Parent Task 2', disable: false },
377
+ ];
378
+
379
+ checkBox(data: any) {
380
+ console.log('checkbox selection', data);
381
+ }
382
+ ```
383
+
384
+ **`CheckBoxConfig` options:**
385
+
386
+ | Property | Type | Description |
387
+ |-----------------|----------|-----------------------------------|
388
+ | `idField` | `string` | Key for option ID |
389
+ | `textField` | `string` | Key for display label |
390
+ | `name` | `string` | HTML checkbox group name |
391
+ | `disabledField` | `string` | Key to mark an option as disabled |
392
+
393
+ ---
394
+
395
+ ### `ToggleComponent` โ€” `<cats-ui-toogle-button>`
396
+
397
+ **Template:**
398
+ ```html
399
+ <cats-ui-toogle-button
400
+ [toggleConfig]="toggleConfig"
401
+ (onToggled)="onToggled($event)">
402
+ </cats-ui-toogle-button>
403
+ ```
404
+
405
+ **TypeScript:**
406
+ ```typescript
407
+ import { ToggleConfig } from 'cats-ui-lib';
408
+
409
+ toggleConfig: ToggleConfig = {
410
+ disabled: false,
411
+ checked: false,
412
+ };
413
+
414
+ onToggled(data: any) {
415
+ console.log('toggled', data);
416
+ }
417
+ ```
418
+
419
+ **`ToggleConfig` options:**
420
+
421
+ | Property | Type | Description |
422
+ |------------|-----------|----------------------------------|
423
+ | `disabled` | `boolean` | Disable the toggle |
424
+ | `checked` | `boolean` | Initial checked state |
425
+
426
+ ---
427
+
428
+ ### `TabComponent` โ€” `<cats-ui-tab>`
429
+
430
+ Supports `horizontal` (default) and `vertical` orientations with optional disabled tabs.
431
+
432
+ **Template:**
433
+ ```html
434
+ <cats-ui-tab
435
+ [activeTab]="0"
436
+ orientation="vertical"
437
+ [disabledTabs]="[1]"
438
+ (selectTab)="onTabSelected($event)">
439
+
440
+ <cats-ui-tab-item>
441
+ <ng-template tabHeading>Home</ng-template>
442
+ <ng-template tabContent>Home content</ng-template>
443
+ </cats-ui-tab-item>
444
+
445
+ <cats-ui-tab-item>
446
+ <ng-template tabHeading>Profile</ng-template>
447
+ <ng-template tabContent>Profile content</ng-template>
448
+ </cats-ui-tab-item>
449
+
450
+ </cats-ui-tab>
451
+ ```
452
+
453
+ **Dynamic tabs with close button:**
454
+ ```html
455
+ <cats-ui-tab
456
+ [activeTab]="activeTabIndex"
457
+ [disabledTabs]="disabledTabs"
458
+ (selectTab)="onTabSelected($event)">
459
+
460
+ @for (tab of tabs; track $index) {
461
+ <cats-ui-tab-item>
462
+ <ng-template tabHeading>
463
+ {{ tab.heading }}
464
+ <span class="btn-close ms-3" (click)="closeTab($index)">x</span>
465
+ </ng-template>
466
+ <ng-template tabContent>{{ tab.content }}</ng-template>
467
+ </cats-ui-tab-item>
468
+ }
469
+
470
+ </cats-ui-tab>
471
+ ```
472
+
473
+ **TypeScript:**
474
+ ```typescript
475
+ tabs = [
476
+ { heading: 'Home', content: 'Home content' },
477
+ { heading: 'Profile', content: 'Profile content' },
478
+ ];
479
+ activeTabIndex = 0;
480
+ disabledTabs: number[] = [1];
481
+
482
+ onTabSelected(index: number) {
483
+ this.activeTabIndex = index;
484
+ }
485
+
486
+ closeTab(index: number) {
487
+ if (this.tabs.length > 1) {
488
+ this.tabs.splice(index, 1);
489
+ if (this.activeTabIndex >= this.tabs.length) {
490
+ this.activeTabIndex = this.tabs.length - 1;
491
+ }
492
+ }
493
+ }
494
+ ```
495
+
496
+ ---
497
+
498
+ ### `TabsetComponent` โ€” `<cats-ui-tabset>`
499
+
500
+ An advanced tabset with add/close tab support, icons, badge counts, and a home tab.
501
+
502
+ **Template:**
503
+ ```html
504
+ <cats-ui-tabset
505
+ [tabs]="tab1"
506
+ [(activeTab)]="activeTab"
507
+ [tabConfig]="tabConfig"
508
+ (tabAdded)="onTabAdded($event)"
509
+ (tabClosed)="onTabClosed($event)"
510
+ (activeTabChange)="activeTabChange($event)">
511
+
512
+ <!-- Tab ID 0 is the Home tab (requires homeTab: true in tabConfig) -->
513
+ <cats-ui-tab-content [tabId]="0">Home Content</cats-ui-tab-content>
514
+ <cats-ui-tab-content [tabId]="1">Tab 1 Content</cats-ui-tab-content>
515
+ <cats-ui-tab-content [tabId]="2">Tab 2 Content</cats-ui-tab-content>
516
+
517
+ </cats-ui-tabset>
518
+ ```
519
+
520
+ **TypeScript:**
521
+ ```typescript
522
+ tabConfig = {
523
+ addTab: true, // Show "+" add tab button
524
+ closeTab: true, // Show close button on tabs
525
+ homeTab: true, // Enable a fixed home tab at ID 0
526
+ type: 'Stroke', // Tab style variant
527
+ };
528
+
529
+ tab1 = [
530
+ { id: 1, title: 'Tab1' },
531
+ {
532
+ id: 2,
533
+ title: 'Tab2',
534
+ leadingIcon: 'images/command.svg',
535
+ tralingIocn: 'images/x-circle.svg',
536
+ count: 67,
537
+ },
538
+ ];
539
+
540
+ activeTab: any;
541
+ tab = 6; // counter for dynamic tab IDs
542
+
543
+ onTabAdded(ev: any) {
544
+ const newTab = {
545
+ id: ++this.tab,
546
+ title: `Dynamic Tab ${this.tab}`,
547
+ };
548
+ this.tab1 = [...this.tab1, newTab];
549
+ this.activeTab = newTab.id;
550
+ }
551
+
552
+ onTabClosed(id: number) {
553
+ console.log('Tab closed:', id);
554
+ }
555
+
556
+ activeTabChange(dt: any) {
557
+ console.log('Active tab:', dt);
558
+ }
559
+ ```
560
+
561
+ **Tab item options:**
562
+
563
+ | Property | Type | Description |
564
+ |---------------|----------|--------------------------------------|
565
+ | `id` | `number` | Unique tab ID |
566
+ | `title` | `string` | Tab label |
567
+ | `leadingIcon` | `string` | Icon path shown before the title |
568
+ | `tralingIocn` | `string` | Icon path shown after the title |
569
+ | `count` | `number` | Badge count shown on the tab |
570
+
571
+ ---
572
+
573
+ ### `CustomDatePickerComponent` โ€” `<cats-ui-custom-date-picker>`
574
+
575
+ Supports `single`, `range`, and `dual` modes with optional time selection.
576
+
577
+ | Mode | Description |
578
+ |----------|-------------------------------------|
579
+ | `single` | Single date picker (ยฑ time) |
580
+ | `range` | Start and end date picker (ยฑ time) |
581
+ | `dual` | Two-calendar view (ยฑ time) |
582
+
583
+ **Template:**
584
+ ```html
585
+ <!-- Single date + time -->
586
+ <cats-ui-custom-date-picker
587
+ [config]="{ mode: 'single', time: true, parentDateFormat: 'MM/dd/yyyy' }"
588
+ (applied)="displayData($event)">
589
+ </cats-ui-custom-date-picker>
590
+
591
+ <!-- Date range -->
592
+ <cats-ui-custom-date-picker
593
+ [config]="{ mode: 'range', time: false, parentDateFormat: 'MM/dd/yyyy' }"
594
+ (applied)="displayData($event)">
595
+ </cats-ui-custom-date-picker>
596
+
597
+ <!-- Date range + time -->
598
+ <cats-ui-custom-date-picker
599
+ [config]="{ mode: 'range', time: true, parentDateFormat: 'MM/dd/yyyy' }"
600
+ (applied)="displayData($event)">
601
+ </cats-ui-custom-date-picker>
602
+
603
+ <!-- Dual calendar -->
604
+ <cats-ui-custom-date-picker
605
+ [config]="{ mode: 'dual', time: false, parentDateFormat: 'MM/dd/yyyy' }"
606
+ (applied)="displayData($event)">
607
+ </cats-ui-custom-date-picker>
608
+
609
+ <!-- Dual calendar + time -->
610
+ <cats-ui-custom-date-picker
611
+ [config]="{ mode: 'dual', time: true, parentDateFormat: 'MM/dd/yyyy' }"
612
+ (applied)="displayData($event)">
613
+ </cats-ui-custom-date-picker>
25
614
  ```
26
615
 
27
- This command will compile your project, and the build artifacts will be placed in the `dist/` directory.
616
+ **Config options:**
617
+
618
+ | Property | Type | Description |
619
+ |--------------------|-----------|-----------------------------------------------------|
620
+ | `mode` | `string` | `'single'` \| `'range'` \| `'dual'` |
621
+ | `time` | `boolean` | Show time picker alongside the date |
622
+ | `parentDateFormat` | `string` | Output date format, e.g. `'MM/dd/yyyy'` |
623
+ | `minDate` | `Date` | Minimum selectable date |
624
+ | `maxDate` | `Date` | Maximum selectable date |
625
+ | `placeholder` | `string` | Placeholder for single-date mode |
626
+ | `fromPlaceholder` | `string` | Placeholder for start date in range/dual mode |
627
+ | `toPlaceholder` | `string` | Placeholder for end date in range/dual mode |
628
+ | `disabledDates` | `Date[]` | Array of dates to disable |
629
+ | `disablePastDays` | `number` | Number of past days to disable |
630
+ | `showDateLabel` | `boolean` | Show label above date input |
631
+ | `showTimeLabel` | `boolean` | Show label above time input |
28
632
 
29
- ### Publishing the Library
633
+ ---
30
634
 
31
- Once the project is built, you can publish your library by following these steps:
635
+ ### `TimestampFilterComponent` โ€” `<cats-ui-timestamp-filter>`
32
636
 
33
- 1. Navigate to the `dist` directory:
34
- ```bash
35
- cd dist/cats-ui
36
- ```
637
+ A pre-built filter component with quick date presets, custom input, and date picker submenus.
37
638
 
38
- 2. Run the `npm publish` command to publish your library to the npm registry:
39
- ```bash
40
- npm publish
41
- ```
639
+ **Template:**
640
+ ```html
641
+ <cats-ui-timestamp-filter
642
+ [config]="timeFilterConfig"
643
+ (selectionChange)="onFilterChange($event)">
644
+ </cats-ui-timestamp-filter>
645
+ ```
42
646
 
43
- ## Running unit tests
647
+ **TypeScript:**
648
+ ```typescript
649
+ timeFilterConfig = {
650
+ title: 'Timestamp Filter',
651
+ showReset: true,
652
+ options: [
653
+ { label: 'Live', value: 'live' },
654
+ { label: 'Today', value: 'today', default: true },
655
+ { label: 'This Week', value: 'week' },
656
+ { label: 'This Month', value: 'month' },
657
+ { label: 'This Financial Year', value: 'fy' },
658
+ { label: 'Last 24 Hours', value: '24h' },
659
+ { label: 'Last 30 days', value: '30d' },
44
660
 
45
- To execute unit tests with the [Karma](https://karma-runner.github.io) test runner, use the following command:
661
+ // Custom number input (e.g. "Last N days")
662
+ { label: 'Last', value: 'last', type: 'input', custom: true },
663
+
664
+ // Date picker submenus
665
+ {
666
+ label: 'Custom Date',
667
+ value: 'date',
668
+ type: 'submenu',
669
+ custom: true,
670
+ pickerMode: 'single',
671
+ parentDateFormat: 'MM/dd/yyyy',
672
+ },
673
+ {
674
+ label: 'Custom Date and Time',
675
+ value: 'datetime',
676
+ type: 'submenu',
677
+ custom: true,
678
+ pickerMode: 'single',
679
+ parentDateFormat: 'MM/dd/yyyy',
680
+ },
681
+ {
682
+ label: 'Custom Date Range',
683
+ value: 'range',
684
+ type: 'submenu',
685
+ custom: true,
686
+ pickerMode: 'range',
687
+ },
688
+ {
689
+ label: 'Custom Date and Time Range',
690
+ value: 'datetimerange',
691
+ type: 'submenu',
692
+ custom: true,
693
+ },
694
+ ],
695
+ };
696
+
697
+ onFilterChange(dt: any) {
698
+ console.log('timestamp filter', dt);
699
+ }
700
+ ```
701
+
702
+ **Config options:**
703
+
704
+ | Property | Type | Description |
705
+ |-------------|-----------|-----------------------------------------|
706
+ | `title` | `string` | Label shown above the filter |
707
+ | `showReset` | `boolean` | Show a reset button |
708
+ | `options` | `array` | Array of filter option objects |
709
+
710
+ **Option object fields:**
711
+
712
+ | Field | Type | Description |
713
+ |--------------------|-----------|-----------------------------------------------------------------|
714
+ | `label` | `string` | Display label for the option |
715
+ | `value` | `string` | Emitted value on selection |
716
+ | `default` | `boolean` | Pre-select this option on load |
717
+ | `type` | `string` | `'input'` for numeric entry, `'submenu'` for date picker popup |
718
+ | `custom` | `boolean` | Marks as a custom/user-defined option |
719
+ | `pickerMode` | `string` | Date picker mode: `'single'` \| `'range'` |
720
+ | `parentDateFormat` | `string` | Output date format for picker submenus |
721
+
722
+ ---
723
+
724
+ ### `Tooltip Directive` โ€” `catsUiTooltip`
725
+
726
+ Apply as an attribute on any HTML element.
727
+
728
+ ```html
729
+ <button catsUiTooltip="This is a tooltip">Hover me</button>
730
+ ```
731
+
732
+ ---
733
+
734
+ ## ๐Ÿ“ Project Structure
735
+
736
+ ```
737
+ cats-ui-lib/
738
+ โ”œโ”€โ”€ accordion/
739
+ โ”œโ”€โ”€ auto-complete-multi-select/
740
+ โ”œโ”€โ”€ auto-complete-single-select/
741
+ โ”œโ”€โ”€ checkbox-button/
742
+ โ”œโ”€โ”€ custom-date-picker/
743
+ โ”œโ”€โ”€ date-time-picker/
744
+ โ”œโ”€โ”€ input/
745
+ โ”œโ”€โ”€ multi-select/
746
+ โ”œโ”€โ”€ radio-button/
747
+ โ”œโ”€โ”€ search-box/
748
+ โ”œโ”€โ”€ single-select/
749
+ โ”œโ”€โ”€ tabs/
750
+ โ”œโ”€โ”€ tabset/
751
+ โ”œโ”€โ”€ timestamp-filter/
752
+ โ””โ”€โ”€ toogle-button/
753
+ ```
754
+
755
+ ---
756
+
757
+ ## ๐Ÿ”— Links
758
+
759
+ - **npm:** [https://www.npmjs.com/package/cats-ui-lib](https://www.npmjs.com/package/cats-ui-lib)
760
+ - **Angular CLI Docs:** [https://angular.dev/tools/cli](https://angular.dev/tools/cli)
761
+
762
+ ---
763
+
764
+ ## ๐Ÿ› ๏ธ Development
765
+
766
+ ### Build the library
46
767
 
47
768
  ```bash
48
- ng test
769
+ ng build cats-ui
49
770
  ```
50
771
 
51
- ## Running end-to-end tests
772
+ ### Run unit tests
52
773
 
53
- For end-to-end (e2e) testing, run:
774
+ ```bash
775
+ ng test
776
+ ```
777
+
778
+ ### Publish to npm
54
779
 
55
780
  ```bash
56
- ng e2e
781
+ ng build cats-ui
782
+ cd dist/cats-ui
783
+ npm publish
57
784
  ```
58
785
 
59
- Angular CLI does not come with an end-to-end testing framework by default. You can choose one that suits your needs.
786
+ ---
787
+
788
+ ## ๐Ÿ“‹ Requirements
789
+
790
+ | Dependency | Version |
791
+ |------------|---------|
792
+ | Angular | >= 19.x |
793
+ | Node.js | >= 18.x |
794
+
795
+ ---
60
796
 
61
- ## Additional Resources
797
+ ## ๐Ÿ“„ License
62
798
 
63
- For more information on using the Angular CLI, including detailed command references, visit the [Angular CLI Overview and Command Reference](https://angular.dev/tools/cli) page.
799
+ MIT ยฉ cats-ui-lib