ngx-lite-form 1.4.9 → 1.5.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 +114 -5
- package/fesm2022/ngx-lite-form.mjs +169 -31
- package/fesm2022/ngx-lite-form.mjs.map +1 -1
- package/index.d.ts +61 -2
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Lite Form: A Lightweight and Powerful Angular Form Library
|
|
2
2
|
|
|
3
|
-
**Lite Form is a comprehensive, open-source library of
|
|
3
|
+
**Lite Form is a comprehensive, open-source library of 18+ standalone components for building modern, reactive forms in Angular (v20+). It provides lightweight, customizable, and fully-typed form controls—from basic inputs to advanced data tables, loading indicators, and badge components—designed to accelerate development and improve user experience.**
|
|
4
4
|
|
|
5
5
|
This library is built for developers who need a robust, out-of-the-box solution for form-heavy applications without the overhead of heavy-weight dependencies. All components are standalone, tree-shakable, and integrate seamlessly with Angular's Reactive Forms module.
|
|
6
6
|
|
|
@@ -47,7 +47,7 @@ Lite Form is ideal for a wide range of applications, including but not limited t
|
|
|
47
47
|
|
|
48
48
|
## Components
|
|
49
49
|
|
|
50
|
-
Lite Form provides
|
|
50
|
+
Lite Form provides 18+ form and UI components. Click on any component below for detailed documentation:
|
|
51
51
|
|
|
52
52
|
### Form Controls
|
|
53
53
|
- **[LiteInput](docs/lite-input.md)** - Text input with floating labels and validation
|
|
@@ -57,6 +57,8 @@ Lite Form provides 15+ form and UI components. Click on any component below for
|
|
|
57
57
|
- **[LiteMultiSelect](docs/lite-multi-select.md)** - Multi-selection dropdown with inline display
|
|
58
58
|
- **[LiteRadio](docs/lite-radio.md)** - Radio button group for single selection
|
|
59
59
|
- **[LiteCheckbox](docs/lite-checkbox.md)** - Checkbox for boolean input
|
|
60
|
+
- **[LiteToggle](docs/lite-toggle.md)** - Modern iOS-style toggle switch for boolean states
|
|
61
|
+
- **[LiteSlider](docs/lite-slider.md)** - Range slider for numeric input with visual feedback
|
|
60
62
|
- **[LiteDate](docs/lite-date.md)** - Date picker with single/range selection
|
|
61
63
|
- **[LiteDateTime](docs/lite-datetime.md)** - Combined date and time picker
|
|
62
64
|
- **[LiteFile](docs/lite-file.md)** - File upload with drag & drop and camera capture
|
|
@@ -69,6 +71,7 @@ Lite Form provides 15+ form and UI components. Click on any component below for
|
|
|
69
71
|
- **[LitePanel](docs/lite-panel.md)** - Modal panel for dialogs and forms
|
|
70
72
|
- **[LiteLoading](docs/lite-loading.md)** - Loading spinner and progress bar
|
|
71
73
|
- **[LiteTabGroup](docs/lite-tab-group.md)** - Tabs with sliding track and Angular projection
|
|
74
|
+
- **[LiteBadge](docs/lite-badge.md)** - Badge and chip component for status indicators and tags
|
|
72
75
|
- **[LiteSnackbar](docs/lite-snackbar.md)** - Toast notifications service
|
|
73
76
|
|
|
74
77
|
---
|
|
@@ -92,13 +95,16 @@ import {
|
|
|
92
95
|
LiteMultiSelect,
|
|
93
96
|
LiteRadio,
|
|
94
97
|
LiteCheckbox,
|
|
98
|
+
LiteToggle,
|
|
99
|
+
LiteSlider,
|
|
95
100
|
LiteDate,
|
|
96
101
|
LiteDateTime,
|
|
97
102
|
LiteFile,
|
|
98
103
|
LiteTable,
|
|
99
104
|
LitePaginator,
|
|
100
105
|
LitePanel,
|
|
101
|
-
LiteLoading
|
|
106
|
+
LiteLoading,
|
|
107
|
+
LiteBadge
|
|
102
108
|
} from 'ngx-lite-form';
|
|
103
109
|
import { FormControl, Validators } from '@angular/forms';
|
|
104
110
|
|
|
@@ -109,9 +115,11 @@ import {
|
|
|
109
115
|
RadioFieldDto,
|
|
110
116
|
DateRangeFieldDto,
|
|
111
117
|
FileFieldDto,
|
|
118
|
+
SliderFieldDto,
|
|
112
119
|
TableFieldDto,
|
|
113
120
|
PaginatorFieldDto,
|
|
114
|
-
LitePanelAction
|
|
121
|
+
LitePanelAction,
|
|
122
|
+
BadgeFieldDto
|
|
115
123
|
} from 'ngx-lite-form';
|
|
116
124
|
|
|
117
125
|
@Component({
|
|
@@ -124,12 +132,15 @@ import {
|
|
|
124
132
|
LiteMultiSelect,
|
|
125
133
|
LiteRadio,
|
|
126
134
|
LiteCheckbox,
|
|
135
|
+
LiteToggle,
|
|
136
|
+
LiteSlider,
|
|
127
137
|
LiteDate,
|
|
128
138
|
LiteDateTime,
|
|
129
139
|
LiteFile,
|
|
130
140
|
LiteTable,
|
|
131
141
|
LitePaginator,
|
|
132
|
-
LiteLoading
|
|
142
|
+
LiteLoading,
|
|
143
|
+
LiteBadge
|
|
133
144
|
],
|
|
134
145
|
templateUrl: './app.component.html',
|
|
135
146
|
styleUrl: './app.component.scss'
|
|
@@ -158,6 +169,20 @@ export class AppComponent {
|
|
|
158
169
|
// Checkbox (using basic FieldDto for boolean)
|
|
159
170
|
agreeField = new FieldDto('I agree to terms', new FormControl<boolean>(false, { nonNullable: true }));
|
|
160
171
|
|
|
172
|
+
// Toggle switch
|
|
173
|
+
notificationsField = new FieldDto('Enable Notifications', new FormControl<boolean>(true, { nonNullable: true }));
|
|
174
|
+
|
|
175
|
+
// Slider
|
|
176
|
+
volumeField = new SliderFieldDto(
|
|
177
|
+
'Volume',
|
|
178
|
+
new FormControl<number>(75, { nonNullable: true }),
|
|
179
|
+
0,
|
|
180
|
+
100,
|
|
181
|
+
1,
|
|
182
|
+
true,
|
|
183
|
+
(value) => `${value}%`
|
|
184
|
+
);
|
|
185
|
+
|
|
161
186
|
// Select dropdown
|
|
162
187
|
countryField = new SelectFieldDto(
|
|
163
188
|
'Country',
|
|
@@ -273,6 +298,21 @@ export class AppComponent {
|
|
|
273
298
|
this.panelResult.set(result);
|
|
274
299
|
this.basicPanelOpen.set(false);
|
|
275
300
|
}
|
|
301
|
+
|
|
302
|
+
// Badge examples
|
|
303
|
+
statusBadge = new BadgeFieldDto('Active', 'success');
|
|
304
|
+
warningBadge = new BadgeFieldDto('Pending', 'warning');
|
|
305
|
+
infoBadge = new BadgeFieldDto('New', 'info', 'small');
|
|
306
|
+
|
|
307
|
+
tags = signal<BadgeFieldDto[]>([
|
|
308
|
+
new BadgeFieldDto('Angular', 'primary', 'medium', true),
|
|
309
|
+
new BadgeFieldDto('TypeScript', 'info', 'medium', true),
|
|
310
|
+
new BadgeFieldDto('RxJS', 'success', 'medium', true)
|
|
311
|
+
]);
|
|
312
|
+
|
|
313
|
+
removeTag(index: number) {
|
|
314
|
+
this.tags.update(current => current.filter((_, i) => i !== index));
|
|
315
|
+
}
|
|
276
316
|
}
|
|
277
317
|
```
|
|
278
318
|
|
|
@@ -284,6 +324,8 @@ export class AppComponent {
|
|
|
284
324
|
<lite-password [control]="passwordField" [showStrengthIndicator]="true"></lite-password>
|
|
285
325
|
<lite-textarea [control]="descriptionField"></lite-textarea>
|
|
286
326
|
<lite-checkbox [control]="agreeField"></lite-checkbox>
|
|
327
|
+
<lite-toggle [control]="notificationsField"></lite-toggle>
|
|
328
|
+
<lite-slider [control]="volumeField"></lite-slider>
|
|
287
329
|
<lite-select [control]="countryField"></lite-select>
|
|
288
330
|
<lite-multi-select [control]="skillsField"></lite-multi-select>
|
|
289
331
|
<lite-radio [control]="planField"></lite-radio>
|
|
@@ -354,6 +396,17 @@ export class AppComponent {
|
|
|
354
396
|
|
|
355
397
|
<!-- Controlled visibility -->
|
|
356
398
|
<lite-loading [visible]="isLoading" [message]="'Please wait...'"></lite-loading>
|
|
399
|
+
|
|
400
|
+
<!-- Badges and Chips -->
|
|
401
|
+
<!-- Status badges -->
|
|
402
|
+
<lite-badge [badge]="statusBadge"></lite-badge>
|
|
403
|
+
<lite-badge [badge]="warningBadge"></lite-badge>
|
|
404
|
+
<lite-badge [badge]="infoBadge"></lite-badge>
|
|
405
|
+
|
|
406
|
+
<!-- Removable tags/chips -->
|
|
407
|
+
@for (tag of tags(); track $index) {
|
|
408
|
+
<lite-badge [badge]="tag" (remove)="removeTag($index)"></lite-badge>
|
|
409
|
+
}
|
|
357
410
|
```
|
|
358
411
|
---
|
|
359
412
|
|
|
@@ -368,6 +421,8 @@ For detailed API documentation, examples, and usage guides for each component, p
|
|
|
368
421
|
- [LiteMultiSelect Documentation](docs/lite-multi-select.md)
|
|
369
422
|
- [LiteRadio Documentation](docs/lite-radio.md)
|
|
370
423
|
- [LiteCheckbox Documentation](docs/lite-checkbox.md)
|
|
424
|
+
- [LiteToggle Documentation](docs/lite-toggle.md)
|
|
425
|
+
- [LiteSlider Documentation](docs/lite-slider.md)
|
|
371
426
|
- [LiteDate Documentation](docs/lite-date.md)
|
|
372
427
|
- [LiteDateTime Documentation](docs/lite-datetime.md)
|
|
373
428
|
- [LiteFile Documentation](docs/lite-file.md)
|
|
@@ -376,6 +431,7 @@ For detailed API documentation, examples, and usage guides for each component, p
|
|
|
376
431
|
- [LitePanel Documentation](docs/lite-panel.md)
|
|
377
432
|
- [LiteLoading Documentation](docs/lite-loading.md)
|
|
378
433
|
- [LiteTabGroup Documentation](docs/lite-tab-group.md)
|
|
434
|
+
- [LiteBadge Documentation](docs/lite-badge.md)
|
|
379
435
|
- [LiteSnackbar Documentation](docs/lite-snackbar.md)
|
|
380
436
|
|
|
381
437
|
---
|
|
@@ -500,6 +556,59 @@ class PaginatorFieldDto {
|
|
|
500
556
|
}
|
|
501
557
|
```
|
|
502
558
|
|
|
559
|
+
### BadgeFieldDto
|
|
560
|
+
Badge and chip configuration for the LiteBadge component.
|
|
561
|
+
|
|
562
|
+
```typescript
|
|
563
|
+
type BadgeVariant = 'default' | 'primary' | 'success' | 'warning' | 'danger' | 'info';
|
|
564
|
+
type BadgeSize = 'small' | 'medium' | 'large';
|
|
565
|
+
|
|
566
|
+
class BadgeFieldDto {
|
|
567
|
+
label: string;
|
|
568
|
+
variant?: BadgeVariant; // Color variant (default: 'default')
|
|
569
|
+
size?: BadgeSize; // Size option (default: 'medium')
|
|
570
|
+
removable?: boolean; // Show remove button (default: false)
|
|
571
|
+
icon?: string; // SVG or HTML string for icon
|
|
572
|
+
|
|
573
|
+
constructor(
|
|
574
|
+
label: string,
|
|
575
|
+
variant: BadgeVariant = 'default',
|
|
576
|
+
size: BadgeSize = 'medium',
|
|
577
|
+
removable: boolean = false,
|
|
578
|
+
icon?: string
|
|
579
|
+
)
|
|
580
|
+
}
|
|
581
|
+
```
|
|
582
|
+
|
|
583
|
+
### SliderFieldDto
|
|
584
|
+
Slider field configuration for the LiteSlider component.
|
|
585
|
+
|
|
586
|
+
```typescript
|
|
587
|
+
class SliderFieldDto {
|
|
588
|
+
label: string;
|
|
589
|
+
formControl: FormControl<number>;
|
|
590
|
+
min?: number; // Minimum value (default: 0)
|
|
591
|
+
max?: number; // Maximum value (default: 100)
|
|
592
|
+
step?: number; // Step increment (default: 1)
|
|
593
|
+
showMinMax?: boolean; // Show min/max labels (default: true)
|
|
594
|
+
valueFormatter?: (value: number) => string; // Custom value formatter
|
|
595
|
+
hint?: string; // Helper text
|
|
596
|
+
|
|
597
|
+
constructor(
|
|
598
|
+
label: string,
|
|
599
|
+
formControl: FormControl<number>,
|
|
600
|
+
min: number = 0,
|
|
601
|
+
max: number = 100,
|
|
602
|
+
step: number = 1,
|
|
603
|
+
showMinMax: boolean = true,
|
|
604
|
+
valueFormatter?: (value: number) => string,
|
|
605
|
+
hint?: string
|
|
606
|
+
)
|
|
607
|
+
}
|
|
608
|
+
```
|
|
609
|
+
|
|
610
|
+
**Note:** LiteToggle uses the standard `FieldDto` with a `FormControl<boolean>`.
|
|
611
|
+
|
|
503
612
|
---
|
|
504
613
|
|
|
505
614
|
## Validation
|