@exhaustive-ui/mcp 0.0.0-stage → 3.0.0-alpha.1
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/LICENSE +23 -0
- package/README.md +167 -2
- package/data/components/accordion.md +421 -0
- package/data/components/animateonscroll.md +163 -0
- package/data/components/autocomplete.md +1077 -0
- package/data/components/autofocus.md +38 -0
- package/data/components/avatar.md +417 -0
- package/data/components/badge.md +234 -0
- package/data/components/blockui.md +108 -0
- package/data/components/breadcrumb.md +178 -0
- package/data/components/button.md +774 -0
- package/data/components/card.md +138 -0
- package/data/components/carousel.md +440 -0
- package/data/components/cascadeselect.md +1387 -0
- package/data/components/chart.md +1178 -0
- package/data/components/checkbox.md +529 -0
- package/data/components/chip.md +180 -0
- package/data/components/colorpicker.md +301 -0
- package/data/components/confirmdialog.md +287 -0
- package/data/components/confirmpopup.md +417 -0
- package/data/components/contextmenu.md +491 -0
- package/data/components/dataview.md +600 -0
- package/data/components/datepicker.md +1262 -0
- package/data/components/dialog.md +622 -0
- package/data/components/divider.md +250 -0
- package/data/components/dock.md +500 -0
- package/data/components/dragdrop.md +285 -0
- package/data/components/drawer.md +510 -0
- package/data/components/dynamicdialog.md +109 -0
- package/data/components/editor.md +291 -0
- package/data/components/fieldset.md +182 -0
- package/data/components/fileupload.md +430 -0
- package/data/components/floatlabel.md +155 -0
- package/data/components/fluid.md +72 -0
- package/data/components/focustrap.md +65 -0
- package/data/components/galleria.md +627 -0
- package/data/components/iconfield.md +246 -0
- package/data/components/iftalabel.md +105 -0
- package/data/components/imagecompare.md +97 -0
- package/data/components/inplace.md +233 -0
- package/data/components/inputgroup.md +306 -0
- package/data/components/inputmask.md +518 -0
- package/data/components/inputnumber.md +675 -0
- package/data/components/inputotp.md +336 -0
- package/data/components/inputtext.md +488 -0
- package/data/components/keyfilter.md +85 -0
- package/data/components/knob.md +462 -0
- package/data/components/listbox.md +798 -0
- package/data/components/llms.md +28 -0
- package/data/components/megamenu.md +587 -0
- package/data/components/menu.md +483 -0
- package/data/components/menubar.md +462 -0
- package/data/components/message.md +449 -0
- package/data/components/metergroup.md +241 -0
- package/data/components/multiselect.md +1047 -0
- package/data/components/orderlist.md +342 -0
- package/data/components/organizationchart.md +197 -0
- package/data/components/overlay.md +217 -0
- package/data/components/paginator.md +314 -0
- package/data/components/panel.md +214 -0
- package/data/components/panelmenu.md +699 -0
- package/data/components/password.md +570 -0
- package/data/components/picklist.md +420 -0
- package/data/components/popover.md +378 -0
- package/data/components/progressbar.md +181 -0
- package/data/components/progressspinner.md +91 -0
- package/data/components/radiobutton.md +377 -0
- package/data/components/rating.md +312 -0
- package/data/components/ripple.md +89 -0
- package/data/components/scroller.md +122 -0
- package/data/components/scrollpanel.md +149 -0
- package/data/components/scrolltop.md +105 -0
- package/data/components/select.md +1206 -0
- package/data/components/selectbutton.md +356 -0
- package/data/components/skeleton.md +242 -0
- package/data/components/slider.md +337 -0
- package/data/components/speeddial.md +589 -0
- package/data/components/splitbutton.md +945 -0
- package/data/components/splitter.md +196 -0
- package/data/components/stepper.md +411 -0
- package/data/components/styleclass.md +126 -0
- package/data/components/table.md +4557 -0
- package/data/components/tabs.md +467 -0
- package/data/components/tag.md +200 -0
- package/data/components/terminal.md +118 -0
- package/data/components/textarea.md +416 -0
- package/data/components/tieredmenu.md +578 -0
- package/data/components/timeline.md +310 -0
- package/data/components/toast.md +596 -0
- package/data/components/togglebutton.md +356 -0
- package/data/components/toggleswitch.md +285 -0
- package/data/components/toolbar.md +182 -0
- package/data/components/tooltip.md +211 -0
- package/data/components/tree.md +746 -0
- package/data/components/treeselect.md +912 -0
- package/data/components/treetable.md +2814 -0
- package/data/components.json +43751 -0
- package/data/llms-full.txt +47433 -0
- package/data/llms.txt +121 -0
- package/data/manifest.json +46513 -0
- package/data/pages/accessibility.md +28 -0
- package/data/pages/animations.md +28 -0
- package/data/pages/configuration.md +210 -0
- package/data/pages/contribution.md +20 -0
- package/data/pages/customicons.md +20 -0
- package/data/pages/faq.md +20 -0
- package/data/pages/icons.md +66 -0
- package/data/pages/installation.md +71 -0
- package/data/pages/llms.md +61 -0
- package/data/pages/passthrough.md +32 -0
- package/data/pages/philosophy.md +28 -0
- package/data/pages/primeflex.md +20 -0
- package/data/pages/rtl.md +12 -0
- package/data/pages/styled.md +132 -0
- package/data/pages/tailwind.md +40 -0
- package/data/pages/unstyled.md +39 -0
- package/data/snapshot.json +9 -0
- package/dist/index.d.mts +448 -0
- package/dist/index.mjs +2501 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +67 -3
|
@@ -0,0 +1,488 @@
|
|
|
1
|
+
# Angular InputText Component
|
|
2
|
+
|
|
3
|
+
InputText is an extension to standard input element with theming and keyfiltering.
|
|
4
|
+
|
|
5
|
+
## Accessibility
|
|
6
|
+
|
|
7
|
+
Screen Reader InputText component renders a native input element that implicitly includes any passed prop. Value to describe the component can either be provided via label tag combined with id prop or using aria-labelledby , aria-label props.
|
|
8
|
+
|
|
9
|
+
## Basic
|
|
10
|
+
|
|
11
|
+
InputText is used as a controlled input with ngModel property.
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import { Component } from '@angular/core';
|
|
15
|
+
import { FormsModule } from '@angular/forms';
|
|
16
|
+
import { InputTextModule } from '@exhaustive-ui/core/inputtext';
|
|
17
|
+
|
|
18
|
+
@Component({
|
|
19
|
+
template: `
|
|
20
|
+
<div class="card flex justify-center">
|
|
21
|
+
<input type="text" pInputText [(ngModel)]="value" />
|
|
22
|
+
</div>
|
|
23
|
+
`,
|
|
24
|
+
standalone: true,
|
|
25
|
+
imports: [InputTextModule, FormsModule]
|
|
26
|
+
})
|
|
27
|
+
export class InputtextBasicDemo {
|
|
28
|
+
value: string;
|
|
29
|
+
}
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Disabled
|
|
33
|
+
|
|
34
|
+
When disabled is present, the element cannot be edited and focused.
|
|
35
|
+
|
|
36
|
+
```typescript
|
|
37
|
+
import { Component } from '@angular/core';
|
|
38
|
+
import { FormsModule } from '@angular/forms';
|
|
39
|
+
import { InputTextModule } from '@exhaustive-ui/core/inputtext';
|
|
40
|
+
|
|
41
|
+
@Component({
|
|
42
|
+
template: `
|
|
43
|
+
<div class="card flex justify-center">
|
|
44
|
+
<input pInputText [disabled]="true" [(ngModel)]="value" />
|
|
45
|
+
</div>
|
|
46
|
+
`,
|
|
47
|
+
standalone: true,
|
|
48
|
+
imports: [InputTextModule, FormsModule]
|
|
49
|
+
})
|
|
50
|
+
export class InputtextDisabledDemo {
|
|
51
|
+
value: string | undefined = 'Disabled';
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Filled
|
|
56
|
+
|
|
57
|
+
Specify the variant property as filled to display the component with a higher visual emphasis than the default outlined style.
|
|
58
|
+
|
|
59
|
+
```typescript
|
|
60
|
+
import { Component } from '@angular/core';
|
|
61
|
+
import { FormsModule } from '@angular/forms';
|
|
62
|
+
import { InputTextModule } from '@exhaustive-ui/core/inputtext';
|
|
63
|
+
|
|
64
|
+
@Component({
|
|
65
|
+
template: `
|
|
66
|
+
<div class="card flex justify-center">
|
|
67
|
+
<input type="text" pInputText [(ngModel)]="value" variant="filled" />
|
|
68
|
+
</div>
|
|
69
|
+
`,
|
|
70
|
+
standalone: true,
|
|
71
|
+
imports: [InputTextModule, FormsModule]
|
|
72
|
+
})
|
|
73
|
+
export class InputtextFilledDemo {
|
|
74
|
+
value: string;
|
|
75
|
+
}
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Float Label
|
|
79
|
+
|
|
80
|
+
FloatLabel visually integrates a label with its form element. Visit FloatLabel documentation for more information.
|
|
81
|
+
|
|
82
|
+
```typescript
|
|
83
|
+
import { Component } from '@angular/core';
|
|
84
|
+
import { FormsModule } from '@angular/forms';
|
|
85
|
+
import { FloatLabelModule } from '@exhaustive-ui/core/floatlabel';
|
|
86
|
+
import { InputTextModule } from '@exhaustive-ui/core/inputtext';
|
|
87
|
+
|
|
88
|
+
@Component({
|
|
89
|
+
template: `
|
|
90
|
+
<div class="card flex flex-wrap justify-center items-end gap-4">
|
|
91
|
+
<p-floatlabel>
|
|
92
|
+
<input pInputText id="over_label" [(ngModel)]="value1" autocomplete="off" />
|
|
93
|
+
<label for="over_label">Over Label</label>
|
|
94
|
+
</p-floatlabel>
|
|
95
|
+
<p-floatlabel variant="in">
|
|
96
|
+
<input pInputText id="in_label" [(ngModel)]="value2" autocomplete="off" />
|
|
97
|
+
<label for="in_label">In Label</label>
|
|
98
|
+
</p-floatlabel>
|
|
99
|
+
<p-floatlabel variant="on">
|
|
100
|
+
<input pInputText id="on_label" [(ngModel)]="value3" autocomplete="off" />
|
|
101
|
+
<label for="on_label">On Label</label>
|
|
102
|
+
</p-floatlabel>
|
|
103
|
+
</div>
|
|
104
|
+
`,
|
|
105
|
+
standalone: true,
|
|
106
|
+
imports: [FloatLabelModule, InputTextModule, FormsModule]
|
|
107
|
+
})
|
|
108
|
+
export class InputtextFloatlabelDemo {
|
|
109
|
+
value1: string | undefined;
|
|
110
|
+
value2: string | undefined;
|
|
111
|
+
value3: string | undefined;
|
|
112
|
+
}
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
## Fluid
|
|
116
|
+
|
|
117
|
+
The fluid prop makes the component take up the full width of its container when set to true.
|
|
118
|
+
|
|
119
|
+
```typescript
|
|
120
|
+
import { Component } from '@angular/core';
|
|
121
|
+
import { FormsModule } from '@angular/forms';
|
|
122
|
+
import { InputTextModule } from '@exhaustive-ui/core/inputtext';
|
|
123
|
+
|
|
124
|
+
@Component({
|
|
125
|
+
template: `
|
|
126
|
+
<div class="card flex justify-center">
|
|
127
|
+
<input type="text" pInputText [(ngModel)]="value" fluid />
|
|
128
|
+
</div>
|
|
129
|
+
`,
|
|
130
|
+
standalone: true,
|
|
131
|
+
imports: [InputTextModule, FormsModule]
|
|
132
|
+
})
|
|
133
|
+
export class InputtextFluidDemo {
|
|
134
|
+
value: string;
|
|
135
|
+
}
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
## Help Text
|
|
139
|
+
|
|
140
|
+
An advisory text can be defined with the semantic small tag.
|
|
141
|
+
|
|
142
|
+
```typescript
|
|
143
|
+
import { Component } from '@angular/core';
|
|
144
|
+
import { FormsModule } from '@angular/forms';
|
|
145
|
+
import { InputTextModule } from '@exhaustive-ui/core/inputtext';
|
|
146
|
+
|
|
147
|
+
@Component({
|
|
148
|
+
template: `
|
|
149
|
+
<div class="card flex justify-center">
|
|
150
|
+
<div class="flex flex-col gap-2">
|
|
151
|
+
<label for="username">Username</label>
|
|
152
|
+
<input pInputText id="username" aria-describedby="username-help" [(ngModel)]="value" />
|
|
153
|
+
<small id="username-help">Enter your username to reset your password.</small>
|
|
154
|
+
</div>
|
|
155
|
+
</div>
|
|
156
|
+
`,
|
|
157
|
+
standalone: true,
|
|
158
|
+
imports: [InputTextModule, FormsModule]
|
|
159
|
+
})
|
|
160
|
+
export class InputtextHelptextDemo {
|
|
161
|
+
value: string | undefined;
|
|
162
|
+
}
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
## icons-doc
|
|
166
|
+
|
|
167
|
+
Icons can be placed inside an input element by wrapping both the input and the icon with an element that has either .p-input-icon-left or p-input-icon-right class.
|
|
168
|
+
|
|
169
|
+
```typescript
|
|
170
|
+
import { Component } from '@angular/core';
|
|
171
|
+
import { FormsModule } from '@angular/forms';
|
|
172
|
+
import { InputTextModule } from '@exhaustive-ui/core/inputtext';
|
|
173
|
+
|
|
174
|
+
@Component({
|
|
175
|
+
template: `
|
|
176
|
+
<div class="card flex flex-wrap justify-center gap-4">
|
|
177
|
+
<span class="p-input-icon-left">
|
|
178
|
+
<i class="pi pi-search"></i>
|
|
179
|
+
<input type="text" pInputText [(ngModel)]="value" />
|
|
180
|
+
</span>
|
|
181
|
+
<span class="p-input-icon-right">
|
|
182
|
+
<i class="pi pi-spin pi-spinner"></i>
|
|
183
|
+
<input type="text" pInputText [(ngModel)]="value2" />
|
|
184
|
+
</span>
|
|
185
|
+
</div>
|
|
186
|
+
`,
|
|
187
|
+
standalone: true,
|
|
188
|
+
imports: [InputTextModule, FormsModule]
|
|
189
|
+
})
|
|
190
|
+
export class InputtextIconsDemo {
|
|
191
|
+
value: string | undefined;
|
|
192
|
+
value2: string | undefined;
|
|
193
|
+
}
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
## Ifta Label
|
|
197
|
+
|
|
198
|
+
IftaLabel is used to create infield top aligned labels. Visit IftaLabel documentation for more information.
|
|
199
|
+
|
|
200
|
+
```typescript
|
|
201
|
+
import { Component } from '@angular/core';
|
|
202
|
+
import { FormsModule } from '@angular/forms';
|
|
203
|
+
import { IftaLabelModule } from '@exhaustive-ui/core/iftalabel';
|
|
204
|
+
import { InputTextModule } from '@exhaustive-ui/core/inputtext';
|
|
205
|
+
|
|
206
|
+
@Component({
|
|
207
|
+
template: `
|
|
208
|
+
<div class="card flex justify-center">
|
|
209
|
+
<p-iftalabel>
|
|
210
|
+
<input pInputText id="username" [(ngModel)]="value" autocomplete="off" />
|
|
211
|
+
<label for="username">Username</label>
|
|
212
|
+
</p-iftalabel>
|
|
213
|
+
</div>
|
|
214
|
+
`,
|
|
215
|
+
standalone: true,
|
|
216
|
+
imports: [IftaLabelModule, InputTextModule, FormsModule]
|
|
217
|
+
})
|
|
218
|
+
export class InputtextIftalabelDemo {
|
|
219
|
+
value: string | undefined;
|
|
220
|
+
}
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
## Invalid
|
|
224
|
+
|
|
225
|
+
The invalid state is applied using the invalid property to indicate failed validation, which can be integrated with Angular Forms.
|
|
226
|
+
|
|
227
|
+
```typescript
|
|
228
|
+
import { Component } from '@angular/core';
|
|
229
|
+
import { FormsModule } from '@angular/forms';
|
|
230
|
+
import { InputTextModule } from '@exhaustive-ui/core/inputtext';
|
|
231
|
+
|
|
232
|
+
@Component({
|
|
233
|
+
template: `
|
|
234
|
+
<div class="card flex flex-wrap justify-center gap-4">
|
|
235
|
+
<input pInputText [(ngModel)]="value1" [invalid]="!value1" placeholder="Name" />
|
|
236
|
+
<input pInputText [(ngModel)]="value2" [invalid]="!value2" variant="filled" placeholder="Name" />
|
|
237
|
+
</div>
|
|
238
|
+
`,
|
|
239
|
+
standalone: true,
|
|
240
|
+
imports: [InputTextModule, FormsModule]
|
|
241
|
+
})
|
|
242
|
+
export class InputtextInvalidDemo {
|
|
243
|
+
value1: string | undefined;
|
|
244
|
+
value2: string | undefined;
|
|
245
|
+
}
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
## keyfilter-doc
|
|
249
|
+
|
|
250
|
+
InputText has built-in key filtering support to block certain keys, refer to keyfilter page for more information.
|
|
251
|
+
|
|
252
|
+
```typescript
|
|
253
|
+
import { Component } from '@angular/core';
|
|
254
|
+
import { FormsModule } from '@angular/forms';
|
|
255
|
+
import { InputTextModule } from '@exhaustive-ui/core/inputtext';
|
|
256
|
+
|
|
257
|
+
@Component({
|
|
258
|
+
template: `
|
|
259
|
+
<div class="card flex justify-center">
|
|
260
|
+
<input pInputText pKeyFilter="int" placeholder="Integers" [(ngModel)]="value" />
|
|
261
|
+
</div>
|
|
262
|
+
`,
|
|
263
|
+
standalone: true,
|
|
264
|
+
imports: [InputTextModule, FormsModule]
|
|
265
|
+
})
|
|
266
|
+
export class InputtextKeyfilterDemo {
|
|
267
|
+
value: number | undefined;
|
|
268
|
+
}
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
## reactiveforms-doc
|
|
272
|
+
|
|
273
|
+
```typescript
|
|
274
|
+
import { Component, inject } from '@angular/core';
|
|
275
|
+
import { ReactiveFormsModule } from '@angular/forms';
|
|
276
|
+
import { MessageModule } from '@exhaustive-ui/core/message';
|
|
277
|
+
import { ToastModule } from '@exhaustive-ui/core/toast';
|
|
278
|
+
import { ButtonModule } from '@exhaustive-ui/core/button';
|
|
279
|
+
import { InputTextModule } from '@exhaustive-ui/core/inputtext';
|
|
280
|
+
import { MessageService } from '@exhaustive-ui/core/api';
|
|
281
|
+
|
|
282
|
+
@Component({
|
|
283
|
+
template: `
|
|
284
|
+
<p-toast />
|
|
285
|
+
<div class="card flex justify-center">
|
|
286
|
+
<form [formGroup]="exampleForm" (ngSubmit)="onSubmit()" class="flex flex-col gap-4 w-full sm:w-56">
|
|
287
|
+
<div class="flex flex-col gap-1">
|
|
288
|
+
<input pInputText type="text" id="username" placeholder="Username" formControlName="username" [invalid]="isInvalid('username')" />
|
|
289
|
+
@if (isInvalid('username')) {
|
|
290
|
+
<p-message severity="error" size="small" variant="simple">Username is required.</p-message>
|
|
291
|
+
}
|
|
292
|
+
</div>
|
|
293
|
+
<div class="flex flex-col gap-1">
|
|
294
|
+
<input pInputText type="email" id="email" placeholder="Email" formControlName="email" [invalid]="isInvalid('email')" />
|
|
295
|
+
@if (isInvalid('email')) {
|
|
296
|
+
@if (exampleForm.get('email')?.errors?.['required']) {
|
|
297
|
+
<p-message severity="error" size="small" variant="simple">Email is required.</p-message>
|
|
298
|
+
}
|
|
299
|
+
@if (exampleForm.get('email')?.errors?.['email']) {
|
|
300
|
+
<p-message severity="error" size="small" variant="simple">Please enter a valid email.</p-message>
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
</div>
|
|
304
|
+
<button pButton severity="secondary" type="submit"><span pButtonLabel>Submit</span></button>
|
|
305
|
+
</form>
|
|
306
|
+
</div>
|
|
307
|
+
`,
|
|
308
|
+
standalone: true,
|
|
309
|
+
imports: [MessageModule, ToastModule, ButtonModule, InputTextModule, ReactiveFormsModule]
|
|
310
|
+
})
|
|
311
|
+
export class InputtextReactiveformsDemo {
|
|
312
|
+
messageService = inject(MessageService);
|
|
313
|
+
exampleForm: FormGroup;
|
|
314
|
+
formSubmitted: boolean = false;
|
|
315
|
+
|
|
316
|
+
constructor() {
|
|
317
|
+
this.exampleForm = this.fb.group({
|
|
318
|
+
username: ['', Validators.required],
|
|
319
|
+
email: ['', [Validators.required, Validators.email]]
|
|
320
|
+
});
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
onSubmit() {
|
|
324
|
+
this.formSubmitted = true;
|
|
325
|
+
if (this.exampleForm.valid) {
|
|
326
|
+
this.messageService.add({ severity: 'success', summary: 'Success', detail: 'Form Submitted', life: 3000 });
|
|
327
|
+
this.exampleForm.reset();
|
|
328
|
+
this.formSubmitted = false;
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
isInvalid(controlName: string) {
|
|
333
|
+
const control = this.exampleForm.get(controlName);
|
|
334
|
+
return control?.invalid && (control.touched || this.formSubmitted);
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
## Sizes
|
|
340
|
+
|
|
341
|
+
InputText provides small and large sizes as alternatives to the standard.
|
|
342
|
+
|
|
343
|
+
```typescript
|
|
344
|
+
import { Component } from '@angular/core';
|
|
345
|
+
import { FormsModule } from '@angular/forms';
|
|
346
|
+
import { InputTextModule } from '@exhaustive-ui/core/inputtext';
|
|
347
|
+
|
|
348
|
+
@Component({
|
|
349
|
+
template: `
|
|
350
|
+
<div class="card flex flex-col items-center gap-4 ">
|
|
351
|
+
<input pInputText [(ngModel)]="value1" type="text" pSize="small" placeholder="Small" />
|
|
352
|
+
<input pInputText [(ngModel)]="value2" type="text" placeholder="Normal" />
|
|
353
|
+
<input pInputText [(ngModel)]="value3" type="text" pSize="large" placeholder="Large" />
|
|
354
|
+
</div>
|
|
355
|
+
`,
|
|
356
|
+
standalone: true,
|
|
357
|
+
imports: [InputTextModule, FormsModule]
|
|
358
|
+
})
|
|
359
|
+
export class InputtextSizesDemo {
|
|
360
|
+
value1: string | undefined;
|
|
361
|
+
value2: string | undefined;
|
|
362
|
+
value3: string | undefined;
|
|
363
|
+
}
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
## templatedrivenforms-doc
|
|
367
|
+
|
|
368
|
+
```typescript
|
|
369
|
+
import { Component, inject } from '@angular/core';
|
|
370
|
+
import { FormsModule } from '@angular/forms';
|
|
371
|
+
import { MessageModule } from '@exhaustive-ui/core/message';
|
|
372
|
+
import { ToastModule } from '@exhaustive-ui/core/toast';
|
|
373
|
+
import { ButtonModule } from '@exhaustive-ui/core/button';
|
|
374
|
+
import { InputTextModule } from '@exhaustive-ui/core/inputtext';
|
|
375
|
+
import { MessageService } from '@exhaustive-ui/core/api';
|
|
376
|
+
|
|
377
|
+
@Component({
|
|
378
|
+
template: `
|
|
379
|
+
<p-toast />
|
|
380
|
+
<div class="card flex justify-center">
|
|
381
|
+
<form #exampleForm="ngForm" (ngSubmit)="onSubmit(exampleForm)" class="flex flex-col gap-4 w-full sm:w-56">
|
|
382
|
+
<div class="flex flex-col gap-1">
|
|
383
|
+
<input pInputText type="text" id="username" placeholder="Username" name="username" [(ngModel)]="user.username" #username="ngModel" [invalid]="username.invalid && (username.touched || exampleForm.submitted)" required />
|
|
384
|
+
@if (username.invalid && (username.touched || exampleForm.submitted)) {
|
|
385
|
+
<p-message severity="error" size="small" variant="simple">Username is required.</p-message>
|
|
386
|
+
}
|
|
387
|
+
</div>
|
|
388
|
+
<div class="flex flex-col gap-1">
|
|
389
|
+
<input pInputText type="email" id="email" name="email" placeholder="Email" [(ngModel)]="user.email" #email="ngModel" required email [invalid]="email.invalid && (email.touched || exampleForm.submitted)" />
|
|
390
|
+
@if (email.invalid && (email.touched || exampleForm.submitted)) {
|
|
391
|
+
<p-message severity="error" size="small" variant="simple">
|
|
392
|
+
@if (email.hasError('required')) {
|
|
393
|
+
Email is Required.
|
|
394
|
+
}
|
|
395
|
+
@if (email.hasError('email')) {
|
|
396
|
+
Please enter a valid email.
|
|
397
|
+
}
|
|
398
|
+
</p-message>
|
|
399
|
+
}
|
|
400
|
+
</div>
|
|
401
|
+
<button pButton severity="secondary" type="submit"><span pButtonLabel>Submit</span></button>
|
|
402
|
+
</form>
|
|
403
|
+
</div>
|
|
404
|
+
`,
|
|
405
|
+
standalone: true,
|
|
406
|
+
imports: [MessageModule, ToastModule, ButtonModule, InputTextModule, FormsModule]
|
|
407
|
+
})
|
|
408
|
+
export class InputtextTemplatedrivenformsDemo {
|
|
409
|
+
messageService = inject(MessageService);
|
|
410
|
+
user: any;
|
|
411
|
+
|
|
412
|
+
onSubmit(form: any) {
|
|
413
|
+
if (form.valid) {
|
|
414
|
+
this.messageService.add({ severity: 'success', summary: 'Success', detail: 'Form Submitted', life: 3000 });
|
|
415
|
+
form.resetForm();
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
```
|
|
420
|
+
|
|
421
|
+
## Input Text
|
|
422
|
+
|
|
423
|
+
InputText directive is an extension to standard input element with theming.
|
|
424
|
+
|
|
425
|
+
### Props
|
|
426
|
+
|
|
427
|
+
| Name | Type | Default | Description |
|
|
428
|
+
|------|------|---------|-------------|
|
|
429
|
+
| dt | InputSignal<Object> | undefined | Defines scoped design tokens of the component. |
|
|
430
|
+
| unstyled | InputSignal<boolean> | undefined | Indicates whether the component should be rendered without styles. |
|
|
431
|
+
| pt | InputSignal<InputTextPassThrough> | undefined | Used to pass attributes to DOM elements inside the component. |
|
|
432
|
+
| ptOptions | InputSignal<PassThroughOptions> | undefined | Used to configure passthrough(pt) options of the component. |
|
|
433
|
+
| ptInputText | InputSignal<InputTextPassThrough> | undefined | Used to pass attributes to DOM elements inside the InputText component. **(Deprecated)** |
|
|
434
|
+
| pInputTextPT | InputSignal<InputTextPassThrough> | undefined | Used to pass attributes to DOM elements inside the InputText component. |
|
|
435
|
+
| pInputTextUnstyled | InputSignal<boolean> | undefined | Indicates whether the component should be rendered without styles. |
|
|
436
|
+
| pSize | InputSignal<"small" \| "large"> | ... | Defines the size of the component. |
|
|
437
|
+
| variant | InputSignal<"outlined" \| "filled"> | undefined | Specifies the input variant of the component. |
|
|
438
|
+
| fluid | InputSignalWithTransform<boolean, unknown> | undefined | Spans 100% width of the container when enabled. |
|
|
439
|
+
| invalid | InputSignalWithTransform<boolean, unknown> | false | When present, it specifies that the component should have invalid state style. |
|
|
440
|
+
|
|
441
|
+
## Pass Through Options
|
|
442
|
+
|
|
443
|
+
| Name | Type | Description |
|
|
444
|
+
|------|------|-------------|
|
|
445
|
+
| root | PassThroughOption<HTMLInputElement, I> | Used to pass attributes to the root's DOM element. |
|
|
446
|
+
|
|
447
|
+
## Theming
|
|
448
|
+
|
|
449
|
+
### CSS Classes
|
|
450
|
+
|
|
451
|
+
| Class | Description |
|
|
452
|
+
|-------|-------------|
|
|
453
|
+
| p-inputtext | The class of root element |
|
|
454
|
+
|
|
455
|
+
### Design Tokens
|
|
456
|
+
|
|
457
|
+
| Token | CSS Variable | Description |
|
|
458
|
+
|-------|--------------|-------------|
|
|
459
|
+
| inputtext.background | --p-inputtext-background | Background of root |
|
|
460
|
+
| inputtext.disabled.background | --p-inputtext-disabled-background | Disabled background of root |
|
|
461
|
+
| inputtext.filled.background | --p-inputtext-filled-background | Filled background of root |
|
|
462
|
+
| inputtext.filled.hover.background | --p-inputtext-filled-hover-background | Filled hover background of root |
|
|
463
|
+
| inputtext.filled.focus.background | --p-inputtext-filled-focus-background | Filled focus background of root |
|
|
464
|
+
| inputtext.border.color | --p-inputtext-border-color | Border color of root |
|
|
465
|
+
| inputtext.hover.border.color | --p-inputtext-hover-border-color | Hover border color of root |
|
|
466
|
+
| inputtext.focus.border.color | --p-inputtext-focus-border-color | Focus border color of root |
|
|
467
|
+
| inputtext.invalid.border.color | --p-inputtext-invalid-border-color | Invalid border color of root |
|
|
468
|
+
| inputtext.color | --p-inputtext-color | Color of root |
|
|
469
|
+
| inputtext.disabled.color | --p-inputtext-disabled-color | Disabled color of root |
|
|
470
|
+
| inputtext.placeholder.color | --p-inputtext-placeholder-color | Placeholder color of root |
|
|
471
|
+
| inputtext.invalid.placeholder.color | --p-inputtext-invalid-placeholder-color | Invalid placeholder color of root |
|
|
472
|
+
| inputtext.shadow | --p-inputtext-shadow | Shadow of root |
|
|
473
|
+
| inputtext.padding.x | --p-inputtext-padding-x | Padding x of root |
|
|
474
|
+
| inputtext.padding.y | --p-inputtext-padding-y | Padding y of root |
|
|
475
|
+
| inputtext.border.radius | --p-inputtext-border-radius | Border radius of root |
|
|
476
|
+
| inputtext.focus.ring.width | --p-inputtext-focus-ring-width | Focus ring width of root |
|
|
477
|
+
| inputtext.focus.ring.style | --p-inputtext-focus-ring-style | Focus ring style of root |
|
|
478
|
+
| inputtext.focus.ring.color | --p-inputtext-focus-ring-color | Focus ring color of root |
|
|
479
|
+
| inputtext.focus.ring.offset | --p-inputtext-focus-ring-offset | Focus ring offset of root |
|
|
480
|
+
| inputtext.focus.ring.shadow | --p-inputtext-focus-ring-shadow | Focus ring shadow of root |
|
|
481
|
+
| inputtext.transition.duration | --p-inputtext-transition-duration | Transition duration of root |
|
|
482
|
+
| inputtext.sm.font.size | --p-inputtext-sm-font-size | Sm font size of root |
|
|
483
|
+
| inputtext.sm.padding.x | --p-inputtext-sm-padding-x | Sm padding x of root |
|
|
484
|
+
| inputtext.sm.padding.y | --p-inputtext-sm-padding-y | Sm padding y of root |
|
|
485
|
+
| inputtext.lg.font.size | --p-inputtext-lg-font-size | Lg font size of root |
|
|
486
|
+
| inputtext.lg.padding.x | --p-inputtext-lg-padding-x | Lg padding x of root |
|
|
487
|
+
| inputtext.lg.padding.y | --p-inputtext-lg-padding-y | Lg padding y of root |
|
|
488
|
+
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# Angular KeyFilter Component
|
|
2
|
+
|
|
3
|
+
KeyFilter is a directive to restrict individual key strokes. In order to restrict the whole input, use InputNumber or InputMask instead.
|
|
4
|
+
|
|
5
|
+
## Accessibility
|
|
6
|
+
|
|
7
|
+
Refer to InputText for accessibility as KeyFilter is a built-in add-on of the InputText.
|
|
8
|
+
|
|
9
|
+
## Presets
|
|
10
|
+
|
|
11
|
+
KeyFilter provides various presets configured with the pKeyFilter property.
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import { Component } from '@angular/core';
|
|
15
|
+
import { InputTextModule } from '@exhaustive-ui/core/inputtext';
|
|
16
|
+
|
|
17
|
+
@Component({
|
|
18
|
+
template: `
|
|
19
|
+
<div class="card">
|
|
20
|
+
<div class="flex flex-wrap gap-4 mb-6">
|
|
21
|
+
<div class="flex-auto">
|
|
22
|
+
<label for="integer" class="font-bold block mb-2"> Integer </label>
|
|
23
|
+
<input pInputText id="integer" pKeyFilter="int" class="w-full" />
|
|
24
|
+
</div>
|
|
25
|
+
<div class="flex-auto">
|
|
26
|
+
<label for="number" class="font-bold block mb-2"> Number </label>
|
|
27
|
+
<input pInputText id="number" pKeyFilter="num" class="w-full" />
|
|
28
|
+
</div>
|
|
29
|
+
<div class="flex-auto">
|
|
30
|
+
<label for="money" class="font-bold block mb-2"> Money </label>
|
|
31
|
+
<input pInputText id="money" pKeyFilter="money" class="w-full" />
|
|
32
|
+
</div>
|
|
33
|
+
</div>
|
|
34
|
+
<div class="flex flex-wrap gap-4">
|
|
35
|
+
<div class="flex-auto">
|
|
36
|
+
<label for="hex" class="font-bold block mb-2"> Hex </label>
|
|
37
|
+
<input pInputText id="hex" pKeyFilter="hex" class="w-full" />
|
|
38
|
+
</div>
|
|
39
|
+
<div class="flex-auto">
|
|
40
|
+
<label for="alphabetic" class="font-bold block mb-2"> Alphabetic </label>
|
|
41
|
+
<input pInputText id="alphabetic" pKeyFilter="alpha" class="w-full" />
|
|
42
|
+
</div>
|
|
43
|
+
<div class="flex-auto">
|
|
44
|
+
<label for="alphanumeric" class="font-bold block mb-2"> Alphanumeric </label>
|
|
45
|
+
<input pInputText id="alphanumeric" pKeyFilter="alphanum" class="w-full" />
|
|
46
|
+
</div>
|
|
47
|
+
</div>
|
|
48
|
+
</div>
|
|
49
|
+
`,
|
|
50
|
+
standalone: true,
|
|
51
|
+
imports: [InputTextModule]
|
|
52
|
+
})
|
|
53
|
+
export class KeyfilterPresetsDemo {}
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Regex
|
|
57
|
+
|
|
58
|
+
In addition to the presets, a regular expression can be configured for customization.
|
|
59
|
+
|
|
60
|
+
```typescript
|
|
61
|
+
import { Component } from '@angular/core';
|
|
62
|
+
import { InputTextModule } from '@exhaustive-ui/core/inputtext';
|
|
63
|
+
|
|
64
|
+
@Component({
|
|
65
|
+
template: `
|
|
66
|
+
<div class="card flex flex-wrap gap-4">
|
|
67
|
+
<div class="flex-auto">
|
|
68
|
+
<label for="blockspace" class="font-bold block mb-2"> Block Space </label>
|
|
69
|
+
<input pInputText id="blockspace" [pKeyFilter]="blockSpace" class="w-full" />
|
|
70
|
+
</div>
|
|
71
|
+
<div class="flex-auto">
|
|
72
|
+
<label for="block" class="font-bold block mb-2"> Block < > * ! </label>
|
|
73
|
+
<input pInputText id="block" [pKeyFilter]="blockChars" class="w-full" />
|
|
74
|
+
</div>
|
|
75
|
+
</div>
|
|
76
|
+
`,
|
|
77
|
+
standalone: true,
|
|
78
|
+
imports: [InputTextModule]
|
|
79
|
+
})
|
|
80
|
+
export class KeyfilterRegexDemo {
|
|
81
|
+
blockSpace: RegExp = /^[^\s]+$/;
|
|
82
|
+
blockChars: RegExp = /^[^<>*!]+$/;
|
|
83
|
+
}
|
|
84
|
+
```
|
|
85
|
+
|