Skip to content

Commit 5f50b37

Browse files
authored
v19.0.2 (#8)
* Add remaining components. * Update public packaging. Convert modules to standalone components.
1 parent 103ba87 commit 5f50b37

33 files changed

+672
-171
lines changed

README.md

Lines changed: 50 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -82,15 +82,20 @@ breakpoints.
8282
The components included in this project are:
8383

8484
- **InputComponent**: A generic input field that can be used for text, email,
85-
password, etc.
85+
password, etc. **InputDropdownOptionComponent**: An option element for the
86+
dropdown list input field.
8687
- **InputCheckboxComponent**: A checkbox input field.
88+
- **InputChipComponent**: A chip element for the chips list input field.
89+
- **InputChipsComponent**: A chips list input field.
8790
- **InputDatepickerComponent**: A datepicker input field.
88-
- **InputDropdownComponent**: A dropdown input field.
89-
- **InputRadioModule**: A radio input options field.
91+
- **InputDropdownComponent**: A dropdown list input field.
92+
- **InputDropdownOptionGroupComponent**: An option group element for the
93+
dropdown list input field.
94+
- **InputRadioComponent**: A radio input options field.
95+
- **InputRadioOptionComponent**: An option element for the radio input field.
9096
- **InputTextareaComponent**: A textarea input field.
9197
- **InputTimepickerComponent**: A timepicker input field.
9298
- **InputToggleComponent**: A toggle input field.
93-
- More to come...
9499

95100
Each component is designed to be easily customized and extended to meet your
96101
specific needs. They are built using Angular Material and Angular CDK, ensuring
@@ -145,9 +150,14 @@ application where used:
145150
+ import {
146151
+ InputComponent,
147152
+ InputCheckboxComponent,
153+
+ InputChipComponent,
154+
+ InputChipsComponent,
148155
+ InputDatepickerComponent,
149156
+ InputDropdownComponent,
150-
+ InputRadioModule,
157+
+ InputDropdownOptionComponent,
158+
+ InputDropdownOptionGroupComponent,
159+
+ InputRadioComponent,
160+
+ InputRadioOptionComponent,
151161
+ InputTextareaComponent,
152162
+ InputTimepickerComponent,
153163
+ InputToggleComponent,
@@ -158,34 +168,58 @@ application where used:
158168
...
159169
imports: [
160170
+ InputComponent,
171+
+ InputCheckboxComponent,
172+
+ InputChipComponent,
173+
+ InputChipsComponent,
174+
+ InputDatepickerComponent,
175+
+ InputDropdownComponent,
176+
+ InputDropdownOptionComponent,
177+
+ InputDropdownOptionGroupComponent,
178+
+ InputRadioComponent,
179+
+ InputRadioOptionComponent,
180+
+ InputTextareaComponent,
181+
+ InputTimepickerComponent,
182+
+ InputToggleComponent,
161183
...
162184
],
163185
})
164186

165187
...
166188

167-
// Or import to component
189+
// Or import to a standalone component
168190
@Component({
169191
...
170192
imports: [
171193
+ InputComponent,
194+
+ InputCheckboxComponent,
195+
+ InputChipComponent,
196+
+ InputChipsComponent,
197+
+ InputDatepickerComponent,
198+
+ InputDropdownComponent,
199+
+ InputDropdownOptionComponent,
200+
+ InputDropdownOptionGroupComponent,
201+
+ InputRadioComponent,
202+
+ InputRadioOptionComponent,
203+
+ InputTextareaComponent,
204+
+ InputTimepickerComponent,
205+
+ InputToggleComponent,
172206
...
173207
],
174208
})
175209

176210
...
177211

178-
// Then use in template
212+
// Then use in template, simplified example form below:
179213
+ <form [formGroup]="formGroup">
180-
+ <pro-input [formControl]="formGroup.controls.input" />
181-
+ <pro-input-checkbox ... />
182-
+ <pro-input-datepicker ... />
183-
+ <pro-input-dropdown ... />
184-
+ <pro-input-radio ... />
185-
+ <pro-input-textarea ... />
186-
+ <pro-input-timepicker ... />
187-
+ <pro-input-toggle ... />
188-
+ ...
214+
+ <pro-input [formControl]="formGroup.controls.input" ... />
215+
+ <pro-input-checkbox [formControl]="formGroup.controls.checkbox" ... />
216+
+ <pro-input-chips [formControl]="formGroup.controls.chips" ... />
217+
+ <pro-input-datepicker [formControl]="formGroup.controls.datepicker" ... />
218+
+ <pro-input-dropdown [formControl]="formGroup.controls.dropdown" ... />
219+
+ <pro-input-radio [formControl]="formGroup.controls.radio" ... />
220+
+ <pro-input-textarea [formControl]="formGroup.controls.textarea" ... />
221+
+ <pro-input-timepicker [formControl]="formGroup.controls.timepicker" ... />
222+
+ <pro-input-toggle [formControl]="formGroup.controls.toggle" ... />
189223
+ </form>
190224
```
191225

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
"@types/luxon": "^3.4.2",
4040
"luxon": "^3.5.0",
4141
"rxjs": "~7.8.0",
42-
"tslib": "^2.3.0",
4342
"zone.js": "~0.15.0"
4443
},
4544
"devDependencies": {
@@ -75,6 +74,7 @@
7574
"ng-packagr": "^19.1.2",
7675
"npm-check-updates": "^17.1.11",
7776
"prettier": "^3.4.1",
77+
"tslib": "^2.3.0",
7878
"typescript": "~5.7.2"
7979
},
8080
"contributors": [

prettier.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/** Prettier configuration and options. */
2-
const prettierConfig = {
2+
var prettierConfig = {
33
$schema: 'https://json.schemastore.org/prettierrc',
44
plugins: ['@trivago/prettier-plugin-sort-imports'],
55
importOrderParserPlugins: ['typescript', 'decorators-legacy'],

src/app/form/form-group-example.ts

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,21 @@ import { DateTime } from 'luxon';
22

33
import { FormControl, FormGroup, Validators } from '@angular/forms';
44

5-
import { RadioOption } from '../public/types';
5+
import { Option } from '../public/types';
66
import { CustomValidators } from '../public/utilities/custom-validators';
77

88
export interface FormGroupExample {
99
checkboxOptional: FormControl<boolean | null>;
1010
checkboxRequired: FormControl<boolean | null>;
11+
chips: FormControl<readonly string[] | null>;
1112
count: FormControl<number | null>;
1213
date: FormControl<DateTime | null>;
1314
description: FormControl<string | null>;
15+
dropdown: FormControl<Option['value'] | null>;
16+
dropdownMultiple: FormControl<ReadonlyArray<Option['value']> | null>;
1417
email: FormControl<string | null>;
1518
name: FormControl<string | null>;
16-
optionsRadio: FormControl<RadioOption['value'] | null>;
19+
optionsRadio: FormControl<Option['value'] | null>;
1720
password: FormControl<string | null>;
1821
time: FormControl<DateTime | null>;
1922
toggleOptional: FormControl<boolean | null>;
@@ -42,6 +45,10 @@ export const formGroupExample = new FormGroup<FormGroupExample>({
4245
checkboxRequired: new FormControl<boolean | null>(null, [
4346
Validators.required,
4447
]),
48+
chips: new FormControl<readonly string[] | null>(null, [
49+
Validators.required,
50+
Validators.maxLength(3),
51+
]),
4552
count: new FormControl<number | null>(null, [
4653
Validators.min(validation.count.min),
4754
Validators.max(validation.count.max),
@@ -55,12 +62,19 @@ export const formGroupExample = new FormGroup<FormGroupExample>({
5562
Validators.required,
5663
Validators.maxLength(validation.description.maxLength),
5764
]),
65+
dropdown: new FormControl<Option['value'] | null>(null, [
66+
Validators.required,
67+
]),
68+
dropdownMultiple: new FormControl<ReadonlyArray<Option['value']> | null>(
69+
null,
70+
[Validators.required, Validators.maxLength(2)],
71+
),
5872
email: new FormControl<string | null>(null, [
5973
Validators.email,
6074
Validators.required,
6175
]),
6276
name: new FormControl<string | null>(null, [Validators.required]),
63-
optionsRadio: new FormControl<RadioOption['value'] | null>(null, [
77+
optionsRadio: new FormControl<Option['value'] | null>(null, [
6478
Validators.required,
6579
]),
6680
password: new FormControl<string | null>(null, [

src/app/form/form.component.html

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,64 @@
7474
placeholder="Enter or select a time"
7575
hint="A time between 8 AM and 8 PM CST."
7676
></pro-input-timepicker>
77+
<!-- DROPDOWN - SINGLE -->
78+
<pro-input-dropdown
79+
[formControl]="formGroup.controls.dropdown"
80+
hint="A single-select dropdown."
81+
label="Dropdown"
82+
placeholder="Select an option"
83+
>
84+
@for (option of dropdownOptions; track option) {
85+
<pro-input-dropdown-option [value]="option.value">{{
86+
option.label
87+
}}</pro-input-dropdown-option>
88+
}
89+
<pro-input-dropdown-option-group label="Grouped Options">
90+
@for (option of groupedDropdownOptions; track option) {
91+
<pro-input-dropdown-option [value]="option.value">{{
92+
option.label
93+
}}</pro-input-dropdown-option>
94+
}
95+
</pro-input-dropdown-option-group>
96+
<pro-input-dropdown-option disabled [value]="1"
97+
>Disabled Option</pro-input-dropdown-option
98+
>
99+
</pro-input-dropdown>
100+
<!-- DROPDOWN - MULTIPLE -->
101+
<pro-input-dropdown
102+
[formControl]="formGroup.controls.dropdownMultiple"
103+
hint="A multi-select dropdown with a max of 2 selections."
104+
label="Dropdown (Multiple)"
105+
multiple
106+
placeholder="Select multiple options"
107+
>
108+
@for (option of dropdownOptions; track option) {
109+
<pro-input-dropdown-option [value]="option.value">{{
110+
option.label
111+
}}</pro-input-dropdown-option>
112+
}
113+
<pro-input-dropdown-option-group label="Grouped Options">
114+
@for (option of groupedDropdownOptions; track option) {
115+
<pro-input-dropdown-option [value]="option.value">{{
116+
option.label
117+
}}</pro-input-dropdown-option>
118+
}
119+
</pro-input-dropdown-option-group>
120+
<pro-input-dropdown-option disabled [value]="1"
121+
>Disabled Option</pro-input-dropdown-option
122+
>
123+
</pro-input-dropdown>
124+
<!-- CHIPS -->
125+
<pro-input-chips
126+
[formControl]="formGroup.controls.chips"
127+
hint="A max of 3 chips."
128+
label="Chips"
129+
multiple
130+
>
131+
@for (chip of chips; track chip) {
132+
<pro-input-chip [value]="chip">{{ chip }}</pro-input-chip>
133+
}
134+
</pro-input-chips>
77135
<!-- OPTIONS RADIO -->
78136
<pro-input-radio
79137
[formControl]="formGroup.controls.optionsRadio"

src/app/form/form.component.scss

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,13 @@ form {
1616

1717
pro-input,
1818
pro-input-checkbox,
19+
pro-input-chips,
1920
pro-input-datepicker,
21+
pro-input-dropdown,
2022
pro-input-radio,
2123
pro-input-timepicker,
22-
pro-input-toggle {
24+
pro-input-toggle,
25+
pro-loading-input {
2326
flex: 0 0 calc(50% - ($gap/ 2));
2427
margin: 0 $margin calc($margin * 2) $margin;
2528
max-width: calc(50% - ($gap / 2));
@@ -67,11 +70,14 @@ form {
6770
:host form {
6871
> pro-input,
6972
> pro-input-checkbox,
73+
> pro-input-chips,
7074
> pro-input-datepicker,
75+
> pro-input-dropdown,
7176
> pro-input-radio,
72-
> pro-input-timepicker,
7377
> pro-input-textarea,
74-
> pro-input-toggle {
78+
> pro-input-timepicker,
79+
> pro-input-toggle,
80+
> pro-loading-input {
7581
flex: 0 0 100%;
7682
margin: 0 0 calc($margin * 2) 0;
7783
max-width: 100%;

0 commit comments

Comments
 (0)