ngx-lite-form 1.2.3 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,23 +1,65 @@
1
- # LiteForm Angular Library
1
+ # Lite Form - Angular Form Components Library
2
2
 
3
- A modern, lightweight Angular form components library with TypeScript support, built-in validation, and responsive design.
3
+ ## Overview
4
+ Lite Form is a comprehensive Angular library that provides lightweight, customizable form components with built-in validation, styling, and animations. It includes input, password, textarea, select, multi-select, radio, checkbox, file upload, advanced date picker, datetime-picker, and panel components designed for Angular 20+ with standalone component support.
4
5
 
5
6
  ## Features
7
+ - ✅ **Modern Angular 20+** - Built with standalone components, signals, and latest CLI tooling
8
+ - ✅ **TypeScript Support** - Fully typed with generic support and DTO helpers
9
+ - ✅ **Reactive Forms** - Integrated with Angular Reactive Forms
10
+ - ✅ **Built-in Validation** - Form validation with error messages and utilities
11
+ - ✅ **Password Security** - Advanced password validation and strength analysis
12
+ - ✅ **Date Handling** - Single date and date range selection with custom formatting
13
+ - ✅ **File Upload** - Drag & drop file upload with camera capture and file management
14
+ - ✅ **Panels & Dialogs** - Template-driven modal panels with configurable action buttons
15
+ - ✅ **Data Tables** - Flexible table component with custom columns, sorting, and pagination
16
+ - ✅ **Pagination** - Standalone pagination component with customizable navigation
17
+ - ✅ **Customizable Styling** - Space-saving SCSS style guide for consistent overrides
18
+ - ✅ **Accessibility** - ARIA-compliant form controls
19
+ - ✅ **Animations** - Smooth transitions and interactions
6
20
 
7
- - 🎯 **Input Component** - Text input with floating labels
8
- - 📝 **Textarea Component** - Multi-line text input
9
- - 📋 **Select Component** - Single-selection dropdown with filtering
10
- - ☑️ **Multi-Select Component** - Multi-selection with inline display
11
- - 🔘 **Radio Component** - Radio button groups for single selection
12
- - **Checkbox Component** - Boolean input with validation support
13
- - 📅 **Date Picker Component** - Advanced date selection with custom formatting
14
- - 📎 **File Upload Component** - Drag & drop, camera capture, file management
15
- - 🕒 **DateTime Picker Component** - Combined date & time selection
16
- - 🔧 **TypeScript Support** - Fully typed with generics
17
- - ✅ **Form Validation** - Integrated Angular Reactive Forms validation
18
- - 🎨 **Customizable Styling** - SCSS-based theming system
19
- - 📱 **Responsive Design** - Mobile-friendly components
20
- - 🏗️ **Standalone Components** - Modern Angular architecture
21
+ ## Components
22
+
23
+ ### 🎯 LiteInput
24
+ Basic text input component with floating labels and validation.
25
+
26
+ ### 🔐 LitePassword
27
+ Password input component with toggle visibility, strength indicator, and advanced validation features.
28
+
29
+ ### 📝 LiteTextarea
30
+ Multi-line text input with auto-resize capabilities.
31
+
32
+ ### 📋 LiteSelect
33
+ Single-selection dropdown with search and filtering.
34
+
35
+ ### ☑️ LiteMultiSelect
36
+ Multi-selection dropdown with inline selected items display and dynamic height adjustment.
37
+
38
+ ### 🔘 LiteRadio
39
+ Radio button group component for single selection from multiple options.
40
+
41
+ ### ✅ LiteCheckbox
42
+ Checkbox component for boolean input with validation support.
43
+
44
+ ### 📅 LiteDate
45
+ Advanced date picker component with single date and date range selection, custom formatting, and intelligent calendar positioning.
46
+
47
+ ### 📎 LiteFile
48
+ File upload component with drag & drop, badge, file management panel, and camera capture support.
49
+
50
+ ### 📅 LiteDateTime
51
+ Date and time picker with timezone-safe handling and consistent formatting utilities.
52
+
53
+ ### 📊 LiteTable
54
+ Flexible data table component with custom columns, cell templates, nested property access, and integrated pagination.
55
+
56
+ ### 📄 LitePaginator
57
+ Standalone pagination component with customizable page navigation, items per page selection, and total item display.
58
+
59
+ ### 🪟 LitePanel
60
+ Modal-style panel component that renders custom templates, configurable header text, and action buttons via `LitePanelAction` definitions. Supports custom `width`, `height`, `maxWidth`, and `maxHeight` inputs with automatic `px` suffix for numeric values.
61
+
62
+ ---
21
63
 
22
64
  ## Installation
23
65
 
@@ -25,266 +67,745 @@ A modern, lightweight Angular form components library with TypeScript support, b
25
67
  npm install ngx-lite-form
26
68
  ```
27
69
 
28
- ## Quick Usage
70
+ ## Quick Start
71
+
72
+ ### 1. Import Components
29
73
 
30
74
  ```typescript
31
- import { LiteInput, LiteSelect, LiteCheckbox } from 'ngx-lite-form';
75
+ import {
76
+ LiteInput,
77
+ LitePassword,
78
+ LiteTextarea,
79
+ LiteSelect,
80
+ LiteMultiSelect,
81
+ LiteRadio,
82
+ LiteCheckbox,
83
+ LiteDate,
84
+ LiteDateTime,
85
+ LiteFile,
86
+ LiteTable,
87
+ LitePaginator,
88
+ LitePanel
89
+ } from 'ngx-lite-form';
32
90
  import { FormControl, Validators } from '@angular/forms';
33
91
 
34
- import { FieldDto, SelectFieldDto } from 'ngx-lite-form';
92
+ import {
93
+ FieldDto,
94
+ SelectFieldDto,
95
+ MultiSelectFieldDto,
96
+ RadioFieldDto,
97
+ DateRangeFieldDto,
98
+ FileFieldDto,
99
+ TableFieldDto,
100
+ PaginatorFieldDto,
101
+ LitePanelAction
102
+ } from 'ngx-lite-form';
35
103
 
36
104
  @Component({
37
105
  standalone: true,
38
- imports: [LiteInput, LiteSelect, LiteCheckbox],
39
- template: `
40
- <lite-input [control]="nameField"></lite-input>
41
- <lite-select [control]="statusField"></lite-select>
42
- <lite-checkbox [control]="agreeField"></lite-checkbox>
43
- `
106
+ imports: [
107
+ LiteInput,
108
+ LitePassword,
109
+ LiteTextarea,
110
+ LiteSelect,
111
+ LiteMultiSelect,
112
+ LiteRadio,
113
+ LiteCheckbox,
114
+ LiteDate,
115
+ LiteDateTime,
116
+ LiteFile,
117
+ LiteTable,
118
+ LitePaginator
119
+ ],
120
+ templateUrl: './app.component.html',
121
+ styleUrl: './app.component.scss'
44
122
  })
45
- export class MyFormComponent {
46
- nameField = new FieldDto('Name', new FormControl('', [Validators.required]));
123
+ export class AppComponent {
124
+ // Basic input
125
+ nameField = new FieldDto('Full Name', new FormControl(''));
126
+
127
+ // Number input
128
+ ageField = new FieldDto('Age', new FormControl(0), 2, 'number');
129
+
130
+ // Password with validation
131
+ passwordField = new FieldDto('Password', new FormControl('', [
132
+ Validators.required,
133
+ Validators.minLength(8),
134
+ Validators.pattern(/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{8,}$/)
135
+ ]));
136
+
137
+ // Textarea
138
+ descriptionField = new FieldDto('Description', new FormControl(''), 4);
139
+
140
+ // Checkbox (using basic FieldDto for boolean)
47
141
  agreeField = new FieldDto('I agree to terms', new FormControl<boolean>(false, { nonNullable: true }));
48
-
49
- statusField = new SelectFieldDto(
50
- 'Status',
142
+
143
+ // Select dropdown
144
+ countryField = new SelectFieldDto(
145
+ 'Country',
51
146
  new FormControl(''),
52
- ['Active', 'Inactive'],
147
+ ['USA', 'Canada', 'Mexico'],
53
148
  (option) => option
54
149
  );
150
+
151
+ // Multi-select
152
+ skillsField = new MultiSelectFieldDto(
153
+ 'Skills',
154
+ new FormControl<string[]>([]),
155
+ ['JavaScript', 'TypeScript', 'Angular', 'React'],
156
+ (option) => option
157
+ );
158
+
159
+ // Radio group
160
+ planField = new RadioFieldDto(
161
+ 'Choose Plan',
162
+ new FormControl(''),
163
+ ['Basic', 'Premium', 'Enterprise'],
164
+ (option) => option
165
+ );
166
+
167
+ // Single date
168
+ birthdateField: FieldDto = {
169
+ label: 'Birth Date',
170
+ formControl: new FormControl<string>('', { nonNullable: true })
171
+ };
172
+
173
+ // Date range
174
+ eventDateField: DateRangeFieldDto = {
175
+ label: 'Event Date Range',
176
+ formControl: new FormControl<string[]>(['', ''], { nonNullable: true })
177
+ };
178
+
179
+ // File upload
180
+ fileField = new FileFieldDto('Attachments', new FormControl([]), {
181
+ multiple: true,
182
+ accept: 'image/*,application/pdf',
183
+ maxFileSize: 5 * 1024 * 1024,
184
+ maxFiles: 5,
185
+ showPreview: true
186
+ });
187
+
188
+ // Table with custom columns
189
+ employeeTable = new TableFieldDto(
190
+ [
191
+ { key: 'name', label: 'Name', flex: '1' },
192
+ { key: 'department', label: 'Department', flex: '0 0 150px' },
193
+ { key: 'salary', label: 'Salary', flex: '0 0 120px', cellTemplate: (value) => `$${value?.toLocaleString() || '0'}` }
194
+ ],
195
+ [
196
+ { name: 'John Smith', department: 'Engineering', salary: 75000 },
197
+ { name: 'Sarah Johnson', department: 'Marketing', salary: 65000 }
198
+ ]
199
+ );
200
+
201
+ // Paginated table
202
+ userTable = new TableFieldDto(
203
+ [
204
+ { key: 'name', label: 'Name', flex: '1' },
205
+ { key: 'email', label: 'Email', flex: '1' },
206
+ { key: 'location.country', label: 'Country', flex: '0 0 120px' }
207
+ ],
208
+ [], // Will be populated by API
209
+ true, // Enable pagination
210
+ new PaginatorFieldDto(1, 100, 10) // Page 1, 100 total items, 10 per page
211
+ );
212
+
213
+ // Standalone paginator
214
+ paginator = new PaginatorFieldDto(1, 500, 25);
215
+
216
+ // Panel demo state
217
+ basicPanelOpen = signal(false);
218
+ panelResult = signal<unknown | null>(null);
219
+ confirmationActions: LitePanelAction[] = [
220
+ { label: 'Confirm', value: 'confirm', variant: 'danger' },
221
+ { label: 'Cancel', value: null, variant: 'secondary' }
222
+ ];
223
+
224
+ openPanel() {
225
+ this.panelResult.set(null);
226
+ this.basicPanelOpen.set(true);
227
+ }
228
+
229
+ onPanelClosed(result: unknown | null) {
230
+ this.panelResult.set(result);
231
+ this.basicPanelOpen.set(false);
232
+ }
55
233
  }
56
234
  ```
57
235
 
58
- ## Components
59
-
60
- ### LiteInput
61
- Basic text input with floating label animation and validation display.
236
+ ### 3. Use in Templates
62
237
 
63
- ```typescript
64
- import { LiteInput, FieldDto } from 'ngx-lite-form';
238
+ ```html
239
+ <form>
240
+ <lite-input [control]="nameField"></lite-input>
241
+ <lite-password [control]="passwordField" [showStrengthIndicator]="true"></lite-password>
242
+ <lite-textarea [control]="descriptionField"></lite-textarea>
243
+ <lite-checkbox [control]="agreeField"></lite-checkbox>
244
+ <lite-select [control]="countryField"></lite-select>
245
+ <lite-multi-select [control]="skillsField"></lite-multi-select>
246
+ <lite-radio [control]="planField"></lite-radio>
247
+ <lite-date [control]="birthdateField"></lite-date>
248
+ <lite-date [control]="eventDateField" [range]="true" [format]="'dd/MM/yyyy'"></lite-date>
249
+ <lite-file [control]="fileField"></lite-file>
250
+ </form>
251
+
252
+ <!-- Data Table -->
253
+ <lite-table [table]="employeeTable"></lite-table>
254
+
255
+ <!-- Paginated Table -->
256
+ <lite-table
257
+ [table]="userTable"
258
+ (pageChange)="onPageChange($event)"
259
+ (itemsPerPageChange)="onItemsPerPageChange($event)">
260
+ </lite-table>
261
+
262
+ <!-- Standalone Paginator -->
263
+ <lite-paginator
264
+ [paginator]="paginator"
265
+ (pageChange)="onPaginatorPageChange($event)"
266
+ (itemsPerPageChange)="onPaginatorItemsChange($event)">
267
+ </lite-paginator>
268
+
269
+ <!-- Lite Panel -->
270
+ <button type="button" (click)="openPanel()">Open Panel</button>
271
+
272
+ @if (basicPanelOpen()) {
273
+ <lite-panel
274
+ [title]="'Review details'"
275
+ [content]="panelTemplate"
276
+ [actions]="confirmationActions"
277
+ (closed)="onPanelClosed($event)">
278
+ </lite-panel>
279
+ }
65
280
 
66
- nameField = new FieldDto('Full Name', new FormControl('', [Validators.required]));
281
+ <ng-template #panelTemplate let-close="close">
282
+ <p>Panel content can render any Angular template.</p>
283
+ <button type="button" (click)="close('acknowledged')">Acknowledge</button>
284
+ </ng-template>
67
285
  ```
286
+ ---
287
+
288
+ ## Component Documentation
289
+
290
+ ### LiteInput Component
68
291
 
69
- ### LiteTextarea
70
- Multi-line text input that supports configurable rows.
292
+ **Selector:** `lite-input`
71
293
 
294
+ **Inputs:**
295
+ - `control: FieldDto` - Field configuration and form control
296
+ - `inEdit: boolean` - Whether the field is in edit mode (default: true)
297
+
298
+ **Example:**
72
299
  ```typescript
73
- import { LiteTextarea, FieldDto } from 'ngx-lite-form';
300
+ // Component
301
+ nameField = new FieldDto('Full Name', new FormControl('', [Validators.required]));
74
302
 
75
- descriptionField = new FieldDto('Description', new FormControl(''), 4);
303
+ // Template
304
+ <lite-input [control]="nameField"></lite-input>
76
305
  ```
77
306
 
78
- ### LitePassword
79
- Password input with strength indicator, toggle visibility, and advanced validation.
307
+ ### LitePassword Component
80
308
 
81
- ```typescript
82
- import { LitePassword, FieldDto } from 'ngx-lite-form';
309
+ **Selector:** `lite-password`
310
+
311
+ **Inputs:**
312
+ - `control: FieldDto` - Field configuration and form control
313
+ - `inEdit: boolean` - Whether the field is in edit mode (default: true)
314
+ - `showToggle: boolean` - Whether to show the password visibility toggle (default: true)
315
+ - `showStrengthIndicator: boolean` - Whether to show password strength indicator (default: false)
316
+
317
+ **Features:**
318
+ - Password visibility toggle with eye/eye-off icons
319
+ - Real-time password strength analysis
320
+ - Advanced password validation error messages
321
+ - Support for complex password patterns
322
+ - Accessibility features (ARIA labels)
83
323
 
324
+ **Example:**
325
+ ```typescript
326
+ // Basic password
84
327
  passwordField = new FieldDto('Password', new FormControl('', [
85
328
  Validators.required,
86
329
  Validators.minLength(8)
87
330
  ]));
331
+
332
+ // Advanced password with pattern validation
333
+ strongPasswordField = new FieldDto('Strong Password', new FormControl('', [
334
+ Validators.required,
335
+ Validators.minLength(8),
336
+ Validators.pattern(/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{8,}$/)
337
+ ]));
338
+
339
+ // Template
340
+ <lite-password [control]="passwordField"></lite-password>
341
+ <lite-password [control]="strongPasswordField" [showStrengthIndicator]="true"></lite-password>
342
+ <lite-password [control]="confirmPasswordField" [showToggle]="false"></lite-password>
88
343
  ```
89
344
 
90
- ### LiteSelect
91
- Single-selection dropdown with search/filtering functionality.
345
+ **Password Strength Analysis:**
346
+ ```typescript
347
+ import { FormUtils } from 'ngx-lite-form';
348
+
349
+ // Analyze password strength programmatically
350
+ const analysis = FormUtils.analyzePasswordStrength('MyStr0ng@Pass');
351
+ // Returns: { score: 6, level: 'Good', feedback: ['Consider using 12+ characters'] }
352
+ ```
353
+
354
+ ### LiteTextarea Component
355
+
356
+ **Selector:** `lite-textarea`
357
+
358
+ **Inputs:**
359
+ - `control: FieldDto` - Field configuration and form control (supports `rows` property)
360
+ - `inEdit: boolean` - Whether the field is in edit mode (default: true)
92
361
 
362
+ **Example:**
93
363
  ```typescript
94
- import { LiteSelect, SelectFieldDto } from 'ngx-lite-form';
364
+ // Component
365
+ // With validation
366
+ descriptionField = new FieldDto('Description', new FormControl(''), 4);
367
+
368
+ // Template
369
+ <lite-textarea [control]="descriptionField"></lite-textarea>
370
+ ```
371
+
372
+ ### LiteSelect Component
373
+
374
+ **Selector:** `lite-select`
95
375
 
376
+ **Inputs:**
377
+ - `control: SelectFieldDto<T>` - Select field configuration with options
378
+ - `inEdit: boolean` - Whether the field is in edit mode (default: true)
379
+
380
+ **Example:**
381
+ ```typescript
382
+ // Component
96
383
  statusField = new SelectFieldDto(
97
384
  'Status',
98
385
  new FormControl(''),
99
- ['Active', 'Inactive', 'Pending'],
100
- (option) => option
386
+ [
387
+ { id: 1, name: 'Active' },
388
+ { id: 2, name: 'Inactive' }
389
+ ],
390
+ (option) => option.name
101
391
  );
392
+
393
+ // Template
394
+ <lite-select [control]="statusField"></lite-select>
102
395
  ```
103
396
 
104
- ### LiteMultiSelect
105
- Multi-selection dropdown with inline selected items display and dynamic height adjustment.
397
+ ### LiteMultiSelect Component
106
398
 
107
- ```typescript
108
- import { LiteMultiSelect, MultiSelectFieldDto } from 'ngx-lite-form';
399
+ **Selector:** `lite-multi-select`
109
400
 
110
- skillsField = new MultiSelectFieldDto(
111
- 'Skills',
401
+ **Inputs:**
402
+ - `control: MultiSelectFieldDto<T>` - Multi-select field configuration
403
+ - `inEdit: boolean` - Whether the field is in edit mode (default: true)
404
+
405
+ **Features:**
406
+ - Inline selected items display
407
+ - Dynamic height adjustment
408
+ - Filtering/search functionality
409
+ - Individual item removal
410
+
411
+ **Example:**
412
+ ```typescript
413
+ // Component
414
+ tagsField = new MultiSelectFieldDto(
415
+ 'Tags',
112
416
  new FormControl<string[]>([]),
113
- ['JavaScript', 'TypeScript', 'Angular'],
417
+ ['Frontend', 'Backend', 'DevOps', 'Testing'],
114
418
  (option) => option
115
419
  );
420
+
421
+ // Template
422
+ <lite-multi-select [control]="tagsField"></lite-multi-select>
116
423
  ```
117
424
 
118
- ### LiteRadio
119
- Radio button group component for single selection from multiple options.
425
+ ### LiteDate Component
120
426
 
427
+ **Selector:** `lite-date`
428
+
429
+ **Inputs:**
430
+ - `control: FieldDto | DateRangeFieldDto` - Date field configuration
431
+ - `inEdit: boolean` - Whether the field is in edit mode (default: true)
432
+ - `format: string` - Date display format (default: 'dd/MM/yyyy')
433
+ - `range: boolean` - Enable date range selection (default: false)
434
+
435
+ **Features:**
436
+ - Single date and date range selection
437
+ - Custom date formatting (dd/MM/yyyy, MM/dd/yyyy, yyyy-MM-dd)
438
+ - Intelligent calendar positioning (auto-adjusts based on screen space)
439
+ - Dual calendar display for range selection
440
+ - Visual range highlighting with different styles for start, end, and in-between dates
441
+ - Manual input parsing with format validation
442
+ - Timezone-safe date handling
443
+ - Today's date highlighting with distinctive styling
444
+ - Auto-close calendar after range selection
445
+
446
+ **Single Date Example:**
121
447
  ```typescript
122
- import { LiteRadio, RadioFieldDto } from 'ngx-lite-form';
448
+ // Component
449
+ birthdateField: FieldDto = {
450
+ label: 'Birth Date',
451
+ formControl: new FormControl<string>('', {
452
+ nonNullable: true,
453
+ validators: [Validators.required]
454
+ })
455
+ };
456
+
457
+ // Template
458
+ <lite-date [control]="birthdateField" [format]="'dd/MM/yyyy'"></lite-date>
459
+ ```
123
460
 
124
- priorityField = new RadioFieldDto(
125
- 'Priority',
126
- new FormControl('', [Validators.required]),
127
- ['Low', 'Medium', 'High'],
128
- (option) => option
129
- );
461
+ **Date Range Example:**
462
+ ```typescript
463
+ // Component
464
+ import { DateRangeFieldDto } from 'ngx-lite-form';
465
+
466
+ eventDateField: DateRangeFieldDto = {
467
+ label: 'Event Date Range',
468
+ formControl: new FormControl<string[]>(['', ''], { nonNullable: true })
469
+ };
470
+
471
+ // Template
472
+ <lite-date [control]="eventDateField" [range]="true" [format]="'dd/MM/yyyy'"></lite-date>
130
473
  ```
131
474
 
132
- ### LiteCheckbox
133
- Checkbox component for boolean input with validation support.
475
+ **Range Selection Behavior:**
476
+ - First click: Sets start date, clears any existing range
477
+ - Second click: Sets end date, completes range selection
478
+ - Clicking same date twice: Resets to single start date
479
+ - Auto-orders dates (earlier date becomes start, later becomes end)
480
+ - Calendar auto-closes 1 second after completing range selection
134
481
 
482
+ ### LiteFile Component
483
+
484
+ **Selector:** `lite-file`
485
+
486
+ **Inputs:**
487
+ - `control: FileFieldDto` - File field configuration including label, FormControl, and file options
488
+ - `inEdit: boolean` - Whether the field is in edit mode (default: true)
489
+
490
+ **Features:**
491
+ - File upload via button, drag & drop, or camera capture (on supported devices)
492
+ - Always-visible badge shows file count
493
+ - Management panel lists files, upload area, and action buttons
494
+ - Camera capture on devices with a camera using `<input type="file" accept="image/*" capture="environment">`
495
+ - Validation: max files, max file size, file type restrictions
496
+ - Image preview with thumbnails for image files
497
+ - Progress tracking for file uploads
498
+ - Accessibility: keyboard and screen reader friendly
499
+
500
+ **Example:**
135
501
  ```typescript
136
- import { LiteCheckbox, FieldDto } from 'ngx-lite-form';
502
+ // Component
503
+ import { FileFieldDto } from 'ngx-lite-form';
504
+
505
+ // Basic file upload
506
+ fileField = new FileFieldDto('Upload Files', new FormControl([]));
137
507
 
138
- agreeField = new FieldDto('I agree to terms', new FormControl<boolean>(false, {
139
- nonNullable: true,
140
- validators: [Validators.requiredTrue]
141
- }));
508
+ // Image upload with restrictions
509
+ imageField = new FileFieldDto(
510
+ 'Profile Picture',
511
+ new FormControl([]),
512
+ false, // single file only
513
+ 'image/*', // images only
514
+ 2 * 1024 * 1024, // 2MB limit
515
+ 1, // max 1 file
516
+ true // show preview
517
+ );
518
+
519
+ // Template
520
+ <lite-file [control]="fileField"></lite-file>
521
+ <lite-file [control]="imageField"></lite-file>
142
522
  ```
143
523
 
144
- ### LiteDate
145
- Advanced date picker component with single date and date range selection, custom formatting, and intelligent calendar positioning.
524
+ **Camera Capture:**
525
+ - The "Take Picture" button opens the device camera using a hidden file input with `accept="image/*" capture="environment"`
526
+ - Works on mobile devices and laptops with a camera
527
+ - On desktops without a camera, the button will do nothing or fall back to file selection
528
+ - No special permissions required, but the browser may prompt for camera access
529
+
530
+ **File Management Panel:**
531
+ - Click the file icon button to open the management panel
532
+ - Drag & drop files or click the upload area to select files
533
+ - Use action buttons to upload files, take a picture, or close the panel
534
+ - Remove files individually or clear all files
535
+
536
+ ### LiteTable Component
146
537
 
538
+ **Selector:** `lite-table`
539
+
540
+ **Inputs:**
541
+ - `table: TableFieldDto<T>` - Table configuration including columns and data
542
+
543
+ **Outputs:**
544
+ - `pageChange: number` - Emitted when user changes page (for paginated tables)
545
+ - `itemsPerPageChange: number` - Emitted when user changes items per page
546
+
547
+ **Features:**
548
+ - Flexbox-based responsive layout for modern table design
549
+ - Custom column definitions with labels, flex sizing, and cell templates
550
+ - Support for nested object property access (dot notation)
551
+ - Integrated pagination with lite-paginator component
552
+ - Custom cell templates for advanced formatting (images, status indicators, dates)
553
+ - Automatic handling of special data formats (name objects, nested properties)
554
+ - Empty state display when no data is available
555
+ - Sorting indicators (visual styling support)
556
+
557
+ **Example:**
147
558
  ```typescript
148
- import { LiteDate, FieldDto } from 'ngx-lite-form';
559
+ // Component
560
+ import { TableFieldDto, TableColumn } from 'ngx-lite-form';
561
+
562
+ interface Product {
563
+ id: number;
564
+ name: string;
565
+ price: number;
566
+ category: string;
567
+ inStock: boolean;
568
+ }
569
+
570
+ const columns: TableColumn[] = [
571
+ { key: 'id', label: 'ID', flex: '0 0 80px' },
572
+ { key: 'name', label: 'Product Name', flex: '2' },
573
+ { key: 'price', label: 'Price', flex: '0 0 100px', cellTemplate: (value) => `$${value?.toFixed(2)}` },
574
+ { key: 'category', label: 'Category', flex: '1' },
575
+ { key: 'inStock', label: 'Status', flex: '0 0 100px', cellTemplate: (value) => value ? '✓ In Stock' : '✗ Out of Stock' }
576
+ ];
149
577
 
150
- birthDateField = new FieldDto('Birth Date', new FormControl(''));
578
+ productTable = new TableFieldDto(columns, productData, false);
579
+
580
+ // Template
581
+ <lite-table [table]="productTable"></lite-table>
151
582
  ```
152
583
 
153
- ### LiteDateTime
154
- Date & time picker component for selecting both date and time, with custom formatting and time granularity.
584
+ ### LitePaginator Component
585
+
586
+ **Selector:** `lite-paginator`
587
+
588
+ **Inputs:**
589
+ - `paginator: PaginatorFieldDto` - Pagination configuration including current page, total items, and items per page
590
+
591
+ **Outputs:**
592
+ - `pageChange: number` - Emitted when user changes page
593
+ - `itemsPerPageChange: number` - Emitted when user changes items per page
594
+
595
+ **Features:**
596
+ - Previous/Next navigation buttons with disabled states
597
+ - Numbered page buttons with active state highlighting
598
+ - Items per page dropdown selection
599
+ - Total items display with customizable formatting
600
+ - Keyboard navigation support (arrow keys)
601
+ - Responsive design that adapts to different screen sizes
602
+ - Accessibility features with ARIA labels and screen reader support
603
+ - Configurable page range display and navigation controls
155
604
 
605
+ **Example:**
156
606
  ```typescript
157
- import { LiteDateTime, FieldDto } from 'ngx-lite-form';
607
+ // Component
608
+ import { PaginatorFieldDto } from 'ngx-lite-form';
158
609
 
159
- eventDateTimeField = new FieldDto('Event Date & Time', new FormControl(''));
610
+ paginator = new PaginatorFieldDto(1, 500, 25); // Page 1, 500 total items, 25 per page
611
+
612
+ // Template
613
+ <lite-paginator
614
+ [paginator]="paginator"
615
+ (pageChange)="onPageChange($event)"
616
+ (itemsPerPageChange)="onItemsPerPageChange($event)">
617
+ </lite-paginator>
160
618
  ```
161
619
 
162
- ### LiteFile
163
- File upload component with drag & drop, badge, file management panel, and camera capture support.
620
+ ## Snackbar Service
621
+
622
+ The library provides a simple snackbar notification service for showing messages at the top of the page. No component or template is needed.
623
+
624
+ ### Usage
625
+
626
+ Inject the service and call `show()` with your message and type:
164
627
 
165
628
  ```typescript
166
- import { LiteFile, FileFieldDto } from 'ngx-lite-form';
629
+ import { LiteSnackbarService } from 'ngx-lite-form';
167
630
 
168
- fileField = new FileFieldDto(
169
- 'Upload Files',
170
- new FormControl([]),
171
- true, // multiple
172
- 'image/*,application/pdf', // accept
173
- 5 * 1024 * 1024, // maxFileSize (5MB)
174
- 5, // maxFiles
175
- true // showPreview
176
- );
631
+ constructor(private snackbar: LiteSnackbarService) {}
632
+
633
+ // Show a success message
634
+ this.snackbar.show('Operation completed!', 'done');
635
+
636
+ // Show a warning
637
+ this.snackbar.show('Please check your input.', 'warn');
638
+
639
+ // Show an error (with custom duration)
640
+ this.snackbar.show('Something went wrong.', 'error', 5000);
177
641
  ```
178
642
 
179
- ## Data Transfer Objects
643
+ - Types: `'done' | 'warn' | 'error'`
644
+ - Duration: Optional, in milliseconds (default: 3000)
645
+
646
+ The snackbar will appear at the top of the page and auto-dismiss.
647
+
648
+ ---
649
+
650
+ ## Data Transfer Objects (DTOs)
180
651
 
181
652
  ### FieldDto
653
+ Basic field configuration for input and textarea components.
654
+
182
655
  ```typescript
183
656
  class FieldDto {
184
657
  label: string;
185
658
  formControl: FormControl;
186
- rows?: number; // For textarea
659
+ rows?: number; // For textarea only
187
660
  }
188
661
  ```
189
662
 
190
- ### SelectFieldDto<T>
663
+ ### BaseSelectFieldDto<T>
664
+ Abstract base class for select components.
665
+
191
666
  ```typescript
192
- class SelectFieldDto<T> {
667
+ abstract class BaseSelectFieldDto<T> {
193
668
  label: string;
194
- formControl: FormControl<T>;
195
669
  options: T[];
196
670
  displayWith: (option: T) => string;
197
671
  }
198
672
  ```
199
673
 
674
+ ### SelectFieldDto<T>
675
+ Single-selection dropdown configuration.
676
+
677
+ ```typescript
678
+ class SelectFieldDto<T> extends BaseSelectFieldDto<T> {
679
+ formControl: FormControl<T>;
680
+ }
681
+ ```
682
+
200
683
  ### MultiSelectFieldDto<T>
684
+ Multi-selection dropdown configuration.
685
+
201
686
  ```typescript
202
- class MultiSelectFieldDto<T> {
203
- label: string;
687
+ class MultiSelectFieldDto<T> extends BaseSelectFieldDto<T> {
204
688
  formControl: FormControl<T[]>;
205
- options: T[];
206
- displayWith: (option: T) => string;
207
689
  }
208
690
  ```
209
691
 
210
- ### RadioFieldDto<T>
692
+ ### DateRangeFieldDto
693
+ Date range selection configuration.
694
+
211
695
  ```typescript
212
- class RadioFieldDto<T> {
213
- label: string;
214
- formControl: FormControl<T>;
215
- options: T[];
216
- displayWith: (option: T) => string;
696
+ interface DateRangeFieldDto extends Omit<FieldDto, 'formControl'> {
697
+ formControl: FormControl<string[]>;
217
698
  }
218
699
  ```
219
700
 
220
701
  ### FileFieldDto
702
+ File field configuration for the LiteFile component.
703
+
221
704
  ```typescript
222
705
  class FileFieldDto {
223
706
  label: string;
224
707
  formControl: FormControl;
225
- multiple?: boolean;
226
- accept?: string;
227
- maxFileSize?: number;
228
- maxFiles?: number;
229
- showPreview?: boolean;
708
+ multiple?: boolean; // Allow multiple file selection (default: true)
709
+ accept?: string; // Accepted file types (default: '*/*')
710
+ maxFileSize?: number; // Maximum file size in bytes (default: 10MB)
711
+ maxFiles?: number; // Maximum number of files allowed (default: 10)
712
+ showPreview?: boolean; // Show image previews (default: true)
230
713
  }
231
714
  ```
232
715
 
716
+ ### TableFieldDto<T>
717
+ Table configuration for the LiteTable component.
718
+
719
+ ```typescript
720
+ class TableFieldDto<T = any> {
721
+ columns: TableColumn[];
722
+ data: T[];
723
+ showPaginator?: boolean;
724
+ paginatorConfig: PaginatorFieldDto;
725
+ }
726
+
727
+ interface TableColumn {
728
+ key: string; // Data property key (supports dot notation)
729
+ label: string; // Column header text
730
+ flex?: string; // CSS flex property (e.g., '0 0 100px', '1')
731
+ sortable?: boolean; // Show sorting indicator
732
+ cellTemplate?: (value: any, row: any) => string; // Custom HTML template
733
+ }
734
+ ```
735
+
736
+ ### PaginatorFieldDto
737
+ Pagination configuration for table and standalone pagination components.
738
+
739
+ ```typescript
740
+ class PaginatorFieldDto {
741
+ currentPage: number;
742
+ totalItems: number;
743
+ itemsPerPage: number;
744
+ }
745
+ ```
746
+
747
+ ---
748
+
233
749
  ## Validation
234
750
 
235
- All components support Angular Reactive Forms validators:
751
+ All components support Angular Reactive Forms validation:
236
752
 
237
753
  ```typescript
238
754
  import { Validators } from '@angular/forms';
239
755
 
240
- const emailField = new FieldDto(
756
+ // Required field
757
+ emailField = new FieldDto(
241
758
  'Email',
242
759
  new FormControl('', [Validators.required, Validators.email])
243
760
  );
761
+
762
+ // Custom validation
763
+ passwordField = new FieldDto(
764
+ 'Password',
765
+ new FormControl('', [
766
+ Validators.required,
767
+ Validators.minLength(8),
768
+ this.customPasswordValidator
769
+ ])
770
+ );
244
771
  ```
245
772
 
246
773
  Error messages are automatically displayed below invalid fields.
247
774
 
248
- ## Styling
775
+ ---
249
776
 
250
- The library includes comprehensive SCSS styling. To customize:
777
+ ## Styling and Customization
251
778
 
252
- ```scss
253
- // Override default styles
254
- .lite-input.in-edit input:focus {
255
- border-color: #your-brand-color;
256
- box-shadow: 0 0 5px rgba(your-brand-color, 0.5);
257
- }
258
- ```
779
+ ### Default Styling
780
+ The library includes pre-built SCSS styles that provide:
781
+ - Floating label animations
782
+ - Focus states and transitions
783
+ - Error styling
784
+ - Responsive design
259
785
 
260
- ## Development
786
+ ### Custom Styling
787
+ - Follow the compact SCSS conventions described in [docs/STYLEGUIDE.md](https://github.com/liangk/lite-form/blob/main/docs/STYLEGUIDE.md).
788
+ - Components expose BEM-style class names for targeted overrides.
789
+ - Import `lite-styles.scss` to leverage shared design tokens and mixins.
261
790
 
262
- ### Building the Library
263
- ```bash
264
- ng build lite-form
265
- ```
791
+ ---
266
792
 
267
- ### Publishing
268
- ```bash
269
- cd dist/lite-form
270
- npm publish
271
- ```
793
+ ## Development
794
+ Project layout at a glance:
272
795
 
273
- ### Running Tests
274
- ```bash
275
- ng test ui-sandbox
796
+ ```
797
+ lite-form/
798
+ ├── projects/lite-form/ # Library source and public API
799
+ ├── projects/ui-sandbox/ # Demo application showcasing components
800
+ ├── docs/ # Documentation, guides, and changelog
801
+ └── scripts/ # Build and publishing utilities
276
802
  ```
277
803
 
278
- ## Browser Support
279
- - Angular 17+
280
- - Chrome 90+
281
- - Firefox 88+
282
- - Safari 14+
283
- - Edge 90+
284
-
804
+ For the full contributor guide and extended structure diagram, see [docs/CONTRIBUTING.md](https://github.com/liangk/lite-form/blob/main/docs/CONTRIBUTING.md).
285
805
  ## License
286
- MIT License
806
+ This project is licensed under the MIT License - see the [LICENSE](https://github.com/liangk/lite-form/blob/main/LICENSE) file for details.
287
807
 
288
808
  ---
289
809
 
290
- For complete documentation and examples, visit the [main repository](https://github.com/liangk/lite-form).
810
+ ## Changelog
811
+ - See [docs/CHANGELOG.md](https://github.com/liangk/lite-form/blob/main/docs/CHANGELOG.md) for the full historical record, including the latest `v1.3.0` release with `LitePanel` and SCSS style-guide updates.