@seniorsistemas/angular-components 18.0.4 → 18.1.0-feature-sds-276-640ecaac
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/esm2022/form-dynamic/components/form-dynamic/form-dynamic.component.mjs +53 -0
- package/esm2022/form-dynamic/core/registry.mjs +10 -0
- package/esm2022/form-dynamic/fields-basic/boolean-field/boolean-field.component.mjs +15 -0
- package/esm2022/form-dynamic/fields-basic/string-field/string-field.component.mjs +15 -0
- package/esm2022/form-dynamic/lib/optional-fields/editor/editor-field/editor-field.component.mjs +30 -0
- package/esm2022/form-dynamic/lib/optional-fields/editor/editor-types.mjs +3 -0
- package/esm2022/form-dynamic/lib/optional-fields/editor/public-api.mjs +8 -0
- package/esm2022/form-dynamic/lib/optional-fields/editor/seniorsistemas-angular-components-form-dynamic-lib-optional-fields-editor.mjs +5 -0
- package/esm2022/form-dynamic/public-api.mjs +10 -0
- package/esm2022/form-dynamic/schemas/field-dynamic.mjs +2 -0
- package/esm2022/form-dynamic/schemas/form-dynamic-schema.mjs +2 -0
- package/esm2022/form-dynamic/seniorsistemas-angular-components-form-dynamic.mjs +5 -0
- package/esm2022/numeric-mask/lib/numeric-mask/numeric-mask.directive.mjs +10 -14
- package/esm2022/pin-code-field/lib/pin-code-field/pin-code-field.component.mjs +460 -0
- package/esm2022/pin-code-field/lib/pin-code-field.module.mjs +16 -0
- package/esm2022/pin-code-field/public-api.mjs +3 -0
- package/esm2022/pin-code-field/seniorsistemas-angular-components-pin-code-field.mjs +5 -0
- package/fesm2022/seniorsistemas-angular-components-form-dynamic-lib-optional-fields-editor.mjs +44 -0
- package/fesm2022/seniorsistemas-angular-components-form-dynamic-lib-optional-fields-editor.mjs.map +1 -0
- package/fesm2022/seniorsistemas-angular-components-form-dynamic.mjs +94 -0
- package/fesm2022/seniorsistemas-angular-components-form-dynamic.mjs.map +1 -0
- package/fesm2022/seniorsistemas-angular-components-numeric-mask.mjs +9 -13
- package/fesm2022/seniorsistemas-angular-components-numeric-mask.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-pin-code-field.mjs +480 -0
- package/fesm2022/seniorsistemas-angular-components-pin-code-field.mjs.map +1 -0
- package/form-dynamic/components/form-dynamic/form-dynamic.component.d.ts +15 -0
- package/form-dynamic/core/registry.d.ts +7 -0
- package/form-dynamic/fields-basic/boolean-field/boolean-field.component.d.ts +9 -0
- package/form-dynamic/fields-basic/string-field/string-field.component.d.ts +9 -0
- package/form-dynamic/index.d.ts +5 -0
- package/form-dynamic/lib/optional-fields/editor/editor-field/editor-field.component.d.ts +15 -0
- package/form-dynamic/lib/optional-fields/editor/editor-types.d.ts +13 -0
- package/form-dynamic/lib/optional-fields/editor/index.d.ts +5 -0
- package/form-dynamic/lib/optional-fields/editor/public-api.d.ts +2 -0
- package/form-dynamic/public-api.d.ts +4 -0
- package/form-dynamic/schemas/field-dynamic.d.ts +20 -0
- package/form-dynamic/schemas/form-dynamic-schema.d.ts +4 -0
- package/numeric-mask/README.md +182 -154
- package/numeric-mask/lib/numeric-mask/numeric-mask.directive.d.ts +2 -7
- package/package.json +32 -14
- package/pin-code-field/README.md +366 -0
- package/pin-code-field/index.d.ts +5 -0
- package/pin-code-field/lib/pin-code-field/pin-code-field.component.d.ts +284 -0
- package/pin-code-field/lib/pin-code-field.module.d.ts +7 -0
- package/pin-code-field/public-api.d.ts +2 -0
|
@@ -0,0 +1,480 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { input, model, output, signal, computed, viewChildren, inject, ElementRef, DestroyRef, effect, forwardRef, Component, NgModule } from '@angular/core';
|
|
3
|
+
import * as i1 from '@angular/common';
|
|
4
|
+
import { CommonModule } from '@angular/common';
|
|
5
|
+
import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Pin Code Field Component
|
|
9
|
+
*
|
|
10
|
+
* A flexible, accessible PIN code input component that implements {@link ControlValueAccessor}
|
|
11
|
+
* for seamless integration with Angular Reactive Forms and Template-driven Forms.
|
|
12
|
+
*
|
|
13
|
+
* Features:
|
|
14
|
+
* - Multiple input fields for PIN/OTP code entry
|
|
15
|
+
* - Configurable code length and character validation
|
|
16
|
+
* - Keyboard navigation (arrow keys, backspace)
|
|
17
|
+
* - Paste support with automatic truncation
|
|
18
|
+
* - Error state display via the `invalid` input
|
|
19
|
+
* - Full accessibility support (ARIA labels, semantic roles)
|
|
20
|
+
* - Signal-based state management
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```html
|
|
24
|
+
* <form [formGroup]="form">
|
|
25
|
+
* <s-pin-code-field
|
|
26
|
+
* formControlName="code"
|
|
27
|
+
* [length]="6"
|
|
28
|
+
* [alphanumeric]="false"
|
|
29
|
+
* [invalid]="(form.get('code')?.invalid && form.get('code')?.dirty) || false"
|
|
30
|
+
* helpText="Enter your 6-digit code"
|
|
31
|
+
* (codeFilled)="onCodeFilled($event)">
|
|
32
|
+
* </s-pin-code-field>
|
|
33
|
+
* </form>
|
|
34
|
+
* ```
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```typescript
|
|
38
|
+
* form = this.fb.group({
|
|
39
|
+
* code: ['', [Validators.required]],
|
|
40
|
+
* });
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
class PinCodeFieldComponent {
|
|
44
|
+
static LAST_INDEX_OFFSET = 1;
|
|
45
|
+
static EMPTY_VALUE = '';
|
|
46
|
+
/**
|
|
47
|
+
* Number of input fields (PIN code length).
|
|
48
|
+
* Must be at least 1.
|
|
49
|
+
*
|
|
50
|
+
* @default 6
|
|
51
|
+
*/
|
|
52
|
+
length = input(6);
|
|
53
|
+
/**
|
|
54
|
+
* Allows alphanumeric and special characters input.
|
|
55
|
+
* When false, only numeric input (0-9) is accepted.
|
|
56
|
+
*
|
|
57
|
+
* @default false
|
|
58
|
+
*/
|
|
59
|
+
alphanumeric = input(false);
|
|
60
|
+
/**
|
|
61
|
+
* Help text displayed below the input fields.
|
|
62
|
+
*
|
|
63
|
+
* @default ''
|
|
64
|
+
*/
|
|
65
|
+
helpText = input('');
|
|
66
|
+
/**
|
|
67
|
+
* Controls the error state visualization of the component.
|
|
68
|
+
* When true, displays red border on input fields.
|
|
69
|
+
* Typically bound to FormControl's invalid and dirty state.
|
|
70
|
+
*
|
|
71
|
+
* @example
|
|
72
|
+
* ```html
|
|
73
|
+
* [invalid]="(control?.invalid && control?.dirty) || false"
|
|
74
|
+
* ```
|
|
75
|
+
* @default false
|
|
76
|
+
*/
|
|
77
|
+
invalid = input(false);
|
|
78
|
+
/**
|
|
79
|
+
* Two-way binding for the disabled state of the component.
|
|
80
|
+
* Disables all input fields and prevents user interaction.
|
|
81
|
+
*
|
|
82
|
+
* @default false
|
|
83
|
+
*/
|
|
84
|
+
disabled = model(false);
|
|
85
|
+
/**
|
|
86
|
+
* Emitted when all PIN code fields are filled.
|
|
87
|
+
* Emits the complete PIN code as a string.
|
|
88
|
+
*
|
|
89
|
+
* @example
|
|
90
|
+
* ```html
|
|
91
|
+
* (codeFilled)="onCodeFilled($event)"
|
|
92
|
+
* ```
|
|
93
|
+
*/
|
|
94
|
+
codeFilled = output();
|
|
95
|
+
/**
|
|
96
|
+
* Signal containing the current values of each input field.
|
|
97
|
+
* Array length matches the `length` input value.
|
|
98
|
+
*/
|
|
99
|
+
inputs = signal([]);
|
|
100
|
+
/**
|
|
101
|
+
* Signal tracking whether the component has been touched by the user.
|
|
102
|
+
* Set to true when the last input field loses focus (blur event).
|
|
103
|
+
*/
|
|
104
|
+
touched = signal(false);
|
|
105
|
+
/**
|
|
106
|
+
* Computed signal indicating whether all PIN code fields are filled.
|
|
107
|
+
* True only when every field contains a non-empty value.
|
|
108
|
+
*/
|
|
109
|
+
isComplete = computed(() => this.inputs().every((input) => input !== ''));
|
|
110
|
+
/**
|
|
111
|
+
* Computed signal containing the complete PIN code as a joined string.
|
|
112
|
+
* Returns empty string if no inputs are filled.
|
|
113
|
+
*/
|
|
114
|
+
currentValue = computed(() => this.inputs().join(''));
|
|
115
|
+
/**
|
|
116
|
+
* Signal tracking if the component host has the ng-invalid class from FormControl validators.
|
|
117
|
+
* Updated reactively whenever the invalid state changes.
|
|
118
|
+
*/
|
|
119
|
+
hasNgInvalidClass = signal(false);
|
|
120
|
+
/**
|
|
121
|
+
* Signal tracking if the FormControl is dirty.
|
|
122
|
+
* Updated reactively whenever the dirty state changes.
|
|
123
|
+
*/
|
|
124
|
+
isControlDirty = signal(false);
|
|
125
|
+
/**
|
|
126
|
+
* Computed signal indicating if the component should show error state.
|
|
127
|
+
* Returns true if:
|
|
128
|
+
* - The `invalid` input is true, OR
|
|
129
|
+
* - The component has the `ng-invalid` class AND the FormControl is dirty (touched/modified)
|
|
130
|
+
* This ensures errors are only shown to the user after they've interacted with the field.
|
|
131
|
+
*/
|
|
132
|
+
hasError = computed(() => this.invalid() || (this.hasNgInvalidClass() && this.isControlDirty()));
|
|
133
|
+
/**
|
|
134
|
+
* ViewChildren reference to all input DOM elements.
|
|
135
|
+
* Used for DOM manipulation (focus, selection).
|
|
136
|
+
*/
|
|
137
|
+
pinInputs = viewChildren('pinInput');
|
|
138
|
+
elementRef = inject(ElementRef);
|
|
139
|
+
destroyRef = inject(DestroyRef);
|
|
140
|
+
onChange = () => { };
|
|
141
|
+
onTouched = () => { };
|
|
142
|
+
constructor() {
|
|
143
|
+
effect(() => {
|
|
144
|
+
const newLength = this.length();
|
|
145
|
+
if (newLength < 1) {
|
|
146
|
+
console.warn('PIN code length must be at least 1');
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
if (this.inputs().length !== newLength) {
|
|
150
|
+
this.inputs.set(Array.from({ length: newLength }, () => ''));
|
|
151
|
+
}
|
|
152
|
+
}, { allowSignalWrites: true });
|
|
153
|
+
// Monitor ng-invalid and ng-dirty classes on the host element for reactive error state
|
|
154
|
+
effect(() => {
|
|
155
|
+
// Access inputs to create dependency on changes
|
|
156
|
+
this.inputs();
|
|
157
|
+
this.invalid();
|
|
158
|
+
// Use setTimeout to defer the check to next tick to ensure Angular has updated DOM classes
|
|
159
|
+
const timeoutId = window.setTimeout(() => {
|
|
160
|
+
const hostElement = this.elementRef.nativeElement;
|
|
161
|
+
const hasNgInvalid = hostElement.classList.contains('ng-invalid');
|
|
162
|
+
const isDirty = hostElement.classList.contains('ng-dirty');
|
|
163
|
+
this.hasNgInvalidClass.set(hasNgInvalid);
|
|
164
|
+
this.isControlDirty.set(isDirty);
|
|
165
|
+
});
|
|
166
|
+
// Cleanup timeout on component destroy
|
|
167
|
+
this.destroyRef.onDestroy(() => {
|
|
168
|
+
clearTimeout(timeoutId);
|
|
169
|
+
});
|
|
170
|
+
}, { allowSignalWrites: true });
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Handles input event on PIN code fields.
|
|
174
|
+
* Validates character input, prevents multiple characters per field,
|
|
175
|
+
* auto-advances to next field when character is entered.
|
|
176
|
+
*
|
|
177
|
+
* @param index - The input field index (0-based)
|
|
178
|
+
* @param event - The input event
|
|
179
|
+
*/
|
|
180
|
+
onInput(index, event) {
|
|
181
|
+
if (this.disabled()) {
|
|
182
|
+
event.preventDefault();
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
const target = event.target;
|
|
186
|
+
const value = target.value;
|
|
187
|
+
if (value.length > 1 || (value && !this.isValidCharacter(value))) {
|
|
188
|
+
this.clearInput(target);
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
this.setInputAtIndex(index, value);
|
|
192
|
+
if (value && index < this.length() - 1) {
|
|
193
|
+
this.focusAndSelectInput(index + 1);
|
|
194
|
+
}
|
|
195
|
+
if (this.isComplete()) {
|
|
196
|
+
this.codeFilled.emit(this.currentValue());
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Handles keyboard events on PIN code fields.
|
|
201
|
+
* Supports arrow navigation (left/right) and backspace key.
|
|
202
|
+
*
|
|
203
|
+
* Keyboard behavior:
|
|
204
|
+
* - ArrowRight: Move focus to next field
|
|
205
|
+
* - ArrowLeft: Move focus to previous field
|
|
206
|
+
* - Backspace: Clear current or previous field and adjust focus
|
|
207
|
+
*
|
|
208
|
+
* @param index - The input field index (0-based)
|
|
209
|
+
* @param event - The keyboard event
|
|
210
|
+
*/
|
|
211
|
+
onKeyDown(index, event) {
|
|
212
|
+
if (this.disabled()) {
|
|
213
|
+
event.preventDefault();
|
|
214
|
+
return;
|
|
215
|
+
}
|
|
216
|
+
const key = event.key;
|
|
217
|
+
switch (key) {
|
|
218
|
+
case 'ArrowRight':
|
|
219
|
+
if (index < this.length() - 1) {
|
|
220
|
+
event.preventDefault();
|
|
221
|
+
this.focusAndSelectInput(index + 1);
|
|
222
|
+
}
|
|
223
|
+
break;
|
|
224
|
+
case 'ArrowLeft':
|
|
225
|
+
if (index > 0) {
|
|
226
|
+
event.preventDefault();
|
|
227
|
+
this.focusAndSelectInput(index - 1);
|
|
228
|
+
}
|
|
229
|
+
break;
|
|
230
|
+
case 'Backspace':
|
|
231
|
+
event.preventDefault();
|
|
232
|
+
this.handleBackspace(index);
|
|
233
|
+
break;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* Handles paste (clipboard) events on PIN code fields.
|
|
238
|
+
* Extracts valid characters from pasted content, filters by character type,
|
|
239
|
+
* and automatically truncates to match field length.
|
|
240
|
+
*
|
|
241
|
+
* Behavior:
|
|
242
|
+
* - Filters characters based on `alphanumeric` setting
|
|
243
|
+
* - Truncates to maximum field count
|
|
244
|
+
* - Fills available fields with pasted content
|
|
245
|
+
* - Emits codeFilled event if all fields are filled
|
|
246
|
+
*
|
|
247
|
+
* @param event - The clipboard event
|
|
248
|
+
*/
|
|
249
|
+
onPaste(event) {
|
|
250
|
+
if (this.disabled()) {
|
|
251
|
+
event.preventDefault();
|
|
252
|
+
return;
|
|
253
|
+
}
|
|
254
|
+
event.preventDefault();
|
|
255
|
+
const validChars = this.extractValidCharactersFromPaste(event);
|
|
256
|
+
if (validChars.length === 0) {
|
|
257
|
+
return;
|
|
258
|
+
}
|
|
259
|
+
const filledInputs = [
|
|
260
|
+
...validChars,
|
|
261
|
+
...Array(this.length() - validChars.length).fill(''),
|
|
262
|
+
];
|
|
263
|
+
this.inputs.set(filledInputs);
|
|
264
|
+
this.updateValue();
|
|
265
|
+
// Focus on the first empty input or the last filled input if all are filled
|
|
266
|
+
const firstEmptyIndex = validChars.length < this.length() ? validChars.length : validChars.length - 1;
|
|
267
|
+
this.focusAndSelectInput(firstEmptyIndex);
|
|
268
|
+
if (this.isComplete()) {
|
|
269
|
+
this.codeFilled.emit(this.currentValue());
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* Handles focus event on PIN code fields.
|
|
274
|
+
* Selects all text in the input field when focused.
|
|
275
|
+
*
|
|
276
|
+
* @param index - The input field index (0-based)
|
|
277
|
+
*/
|
|
278
|
+
onFocus(index) {
|
|
279
|
+
const input = this.pinInputs()[index];
|
|
280
|
+
if (input) {
|
|
281
|
+
input.nativeElement.select();
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* Handles blur event on PIN code fields.
|
|
286
|
+
* Marks the component as touched when the last input field loses focus.
|
|
287
|
+
* Also notifies the registered onTouched callback for FormControl integration.
|
|
288
|
+
*
|
|
289
|
+
* @param index - The input field index (0-based)
|
|
290
|
+
*/
|
|
291
|
+
onBlur(index) {
|
|
292
|
+
// Only mark as touched when the LAST input loses focus
|
|
293
|
+
if (index === this.length() - PinCodeFieldComponent.LAST_INDEX_OFFSET) {
|
|
294
|
+
this.touched.set(true);
|
|
295
|
+
this.onTouched();
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
/**
|
|
299
|
+
* Clears the input value at specified index and adjusts focus accordingly.
|
|
300
|
+
* If current field is empty, moves to previous field and clears it.
|
|
301
|
+
*
|
|
302
|
+
* @private
|
|
303
|
+
* @param index - The input field index (0-based)
|
|
304
|
+
*/
|
|
305
|
+
handleBackspace(index) {
|
|
306
|
+
const currentInputs = this.inputs();
|
|
307
|
+
// If current input has value, clear it
|
|
308
|
+
if (currentInputs[index]) {
|
|
309
|
+
this.setInputAtIndex(index, PinCodeFieldComponent.EMPTY_VALUE);
|
|
310
|
+
return;
|
|
311
|
+
}
|
|
312
|
+
// Otherwise, clear previous input and focus it
|
|
313
|
+
if (index > 0) {
|
|
314
|
+
this.setInputAtIndex(index - 1, PinCodeFieldComponent.EMPTY_VALUE);
|
|
315
|
+
this.focusAndSelectInput(index - 1);
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
/**
|
|
319
|
+
* Sets the value at a specific input field index and updates the form value.
|
|
320
|
+
* Updates the signal and triggers the change detection via onChange callback.
|
|
321
|
+
*
|
|
322
|
+
* @private
|
|
323
|
+
* @param index - The input field index (0-based)
|
|
324
|
+
* @param value - The value to set in the field
|
|
325
|
+
*/
|
|
326
|
+
setInputAtIndex(index, value) {
|
|
327
|
+
const currentInputs = this.inputs();
|
|
328
|
+
currentInputs[index] = value;
|
|
329
|
+
this.inputs.set([...currentInputs]);
|
|
330
|
+
this.updateValue();
|
|
331
|
+
}
|
|
332
|
+
/**
|
|
333
|
+
* Focuses on and selects text in the input field at the specified index.
|
|
334
|
+
* Uses queueMicrotask to ensure DOM is updated before focusing.
|
|
335
|
+
*
|
|
336
|
+
* @private
|
|
337
|
+
* @param index - The input field index (0-based)
|
|
338
|
+
*/
|
|
339
|
+
focusAndSelectInput(index) {
|
|
340
|
+
queueMicrotask(() => {
|
|
341
|
+
const input = this.pinInputs()[index];
|
|
342
|
+
if (input) {
|
|
343
|
+
input.nativeElement.focus();
|
|
344
|
+
input.nativeElement.select();
|
|
345
|
+
}
|
|
346
|
+
});
|
|
347
|
+
}
|
|
348
|
+
/**
|
|
349
|
+
* Clears the value of an input element.
|
|
350
|
+
* Used for input validation to reject invalid characters.
|
|
351
|
+
*
|
|
352
|
+
* @private
|
|
353
|
+
* @param target - The HTML input element to clear
|
|
354
|
+
*/
|
|
355
|
+
clearInput(target) {
|
|
356
|
+
target.value = '';
|
|
357
|
+
}
|
|
358
|
+
/**
|
|
359
|
+
* Extracts valid characters from pasted content.
|
|
360
|
+
* Filters based on alphanumeric setting and limits to component's length.
|
|
361
|
+
*
|
|
362
|
+
* @private
|
|
363
|
+
* @param event - The clipboard event
|
|
364
|
+
* @returns Array of valid characters from the pasted content
|
|
365
|
+
*/
|
|
366
|
+
extractValidCharactersFromPaste(event) {
|
|
367
|
+
const pastedText = (event.clipboardData?.getData('text') || '').trim();
|
|
368
|
+
return pastedText
|
|
369
|
+
.split('')
|
|
370
|
+
.filter((char) => this.isValidCharacter(char))
|
|
371
|
+
.slice(0, this.length());
|
|
372
|
+
}
|
|
373
|
+
/**
|
|
374
|
+
* Validates if a character is acceptable based on component configuration.
|
|
375
|
+
* For numeric mode, accepts only digits 0-9.
|
|
376
|
+
* For alphanumeric mode, accepts any non-whitespace character.
|
|
377
|
+
*
|
|
378
|
+
* @private
|
|
379
|
+
* @param char - The character to validate
|
|
380
|
+
* @returns true if character is valid, false otherwise
|
|
381
|
+
*/
|
|
382
|
+
isValidCharacter(char) {
|
|
383
|
+
if (this.alphanumeric()) {
|
|
384
|
+
return char.trim().length > 0;
|
|
385
|
+
}
|
|
386
|
+
return /^[0-9]$/.test(char);
|
|
387
|
+
}
|
|
388
|
+
/**
|
|
389
|
+
* Updates the form value by calling the onChange callback registered by FormControl.
|
|
390
|
+
* This ensures the reactive form stays synchronized with component state.
|
|
391
|
+
*
|
|
392
|
+
* @private
|
|
393
|
+
*/
|
|
394
|
+
updateValue() {
|
|
395
|
+
this.onChange(this.currentValue());
|
|
396
|
+
}
|
|
397
|
+
/**
|
|
398
|
+
* Implements ControlValueAccessor interface.
|
|
399
|
+
* Called by the FormControl to write a value to the component.
|
|
400
|
+
* Only accepts string values with length matching the component's length setting.
|
|
401
|
+
*
|
|
402
|
+
* @param value - The value to write (typically from the FormControl)
|
|
403
|
+
*/
|
|
404
|
+
writeValue(value) {
|
|
405
|
+
if (value) {
|
|
406
|
+
const stringValue = String(value);
|
|
407
|
+
if (stringValue.length === this.length()) {
|
|
408
|
+
this.inputs.set(stringValue.split(''));
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
/**
|
|
413
|
+
* Implements ControlValueAccessor interface.
|
|
414
|
+
* Called by the FormControl when value changes.
|
|
415
|
+
* Registers the callback to be called when the component value changes.
|
|
416
|
+
*
|
|
417
|
+
* @param fn - Callback function to invoke when component value changes
|
|
418
|
+
*/
|
|
419
|
+
registerOnChange(fn) {
|
|
420
|
+
this.onChange = fn;
|
|
421
|
+
}
|
|
422
|
+
/**
|
|
423
|
+
* Implements ControlValueAccessor interface.
|
|
424
|
+
* Called by the FormControl to register the touched callback.
|
|
425
|
+
* The callback is invoked when the last input field loses focus.
|
|
426
|
+
*
|
|
427
|
+
* @param fn - Callback function to invoke when component is touched
|
|
428
|
+
*/
|
|
429
|
+
registerOnTouched(fn) {
|
|
430
|
+
this.onTouched = fn;
|
|
431
|
+
}
|
|
432
|
+
/**
|
|
433
|
+
* Implements ControlValueAccessor interface.
|
|
434
|
+
* Called by the FormControl to set the disabled state of the component.
|
|
435
|
+
* Updates the disabled model to reflect the form's disabled state.
|
|
436
|
+
*
|
|
437
|
+
* @param isDisabled - Whether the component should be disabled
|
|
438
|
+
*/
|
|
439
|
+
setDisabledState(isDisabled) {
|
|
440
|
+
this.disabled.set(isDisabled);
|
|
441
|
+
}
|
|
442
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: PinCodeFieldComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
443
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.14", type: PinCodeFieldComponent, isStandalone: true, selector: "s-pin-code-field", inputs: { length: { classPropertyName: "length", publicName: "length", isSignal: true, isRequired: false, transformFunction: null }, alphanumeric: { classPropertyName: "alphanumeric", publicName: "alphanumeric", isSignal: true, isRequired: false, transformFunction: null }, helpText: { classPropertyName: "helpText", publicName: "helpText", isSignal: true, isRequired: false, transformFunction: null }, invalid: { classPropertyName: "invalid", publicName: "invalid", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { disabled: "disabledChange", codeFilled: "codeFilled" }, providers: [
|
|
444
|
+
{
|
|
445
|
+
provide: NG_VALUE_ACCESSOR,
|
|
446
|
+
useExisting: forwardRef(() => PinCodeFieldComponent),
|
|
447
|
+
multi: true,
|
|
448
|
+
},
|
|
449
|
+
], viewQueries: [{ propertyName: "pinInputs", predicate: ["pinInput"], descendants: true, isSignal: true }], ngImport: i0, template: "<div class=\"gap-xsmall flex flex-col\">\n <div\n class=\"flex gap-2\"\n role=\"group\"\n aria-label=\"PIN code input\"\n [attr.aria-labelledby]=\"helpText() ? 'pin-help-text' : null\"\n >\n @for (input of inputs(); let i = $index; track i) {\n <input\n #pinInput\n type=\"text\"\n class=\"h-12 w-12 rounded-xbig border text-center text-lg font-medium transition-all duration-200\"\n [ngClass]=\"{\n 'border-criticality-red focus:ring-criticality-red': hasError(),\n 'border-grayscale-30 focus:border-primary focus:ring-primary': !hasError(),\n 'cursor-not-allowed bg-grayscale-10 text-grayscale-60': disabled(),\n 'bg-grayscale-0 text-grayscale-100 focus:outline-none': !disabled(),\n }\"\n [value]=\"input\"\n [disabled]=\"disabled()\"\n [attr.maxlength]=\"1\"\n [attr.inputmode]=\"alphanumeric() ? 'text' : 'numeric'\"\n [attr.aria-label]=\"'PIN code character ' + (i + 1) + ' of ' + length()\"\n [attr.aria-describedby]=\"helpText() ? 'pin-help-text' : null\"\n [attr.aria-required]=\"true\"\n autocomplete=\"off\"\n (input)=\"onInput(i, $event)\"\n (keydown)=\"onKeyDown(i, $event)\"\n (paste)=\"onPaste($event)\"\n (focus)=\"onFocus(i)\"\n (blur)=\"onBlur(i)\"\n />\n }\n </div>\n\n @if (helpText()) {\n <div\n id=\"pin-help-text\"\n class=\"mt-small text-sm text-grayscale-60\"\n >\n {{ helpText() }}\n </div>\n }\n</div>\n\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] });
|
|
450
|
+
}
|
|
451
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: PinCodeFieldComponent, decorators: [{
|
|
452
|
+
type: Component,
|
|
453
|
+
args: [{ selector: 's-pin-code-field', standalone: true, imports: [CommonModule], providers: [
|
|
454
|
+
{
|
|
455
|
+
provide: NG_VALUE_ACCESSOR,
|
|
456
|
+
useExisting: forwardRef(() => PinCodeFieldComponent),
|
|
457
|
+
multi: true,
|
|
458
|
+
},
|
|
459
|
+
], template: "<div class=\"gap-xsmall flex flex-col\">\n <div\n class=\"flex gap-2\"\n role=\"group\"\n aria-label=\"PIN code input\"\n [attr.aria-labelledby]=\"helpText() ? 'pin-help-text' : null\"\n >\n @for (input of inputs(); let i = $index; track i) {\n <input\n #pinInput\n type=\"text\"\n class=\"h-12 w-12 rounded-xbig border text-center text-lg font-medium transition-all duration-200\"\n [ngClass]=\"{\n 'border-criticality-red focus:ring-criticality-red': hasError(),\n 'border-grayscale-30 focus:border-primary focus:ring-primary': !hasError(),\n 'cursor-not-allowed bg-grayscale-10 text-grayscale-60': disabled(),\n 'bg-grayscale-0 text-grayscale-100 focus:outline-none': !disabled(),\n }\"\n [value]=\"input\"\n [disabled]=\"disabled()\"\n [attr.maxlength]=\"1\"\n [attr.inputmode]=\"alphanumeric() ? 'text' : 'numeric'\"\n [attr.aria-label]=\"'PIN code character ' + (i + 1) + ' of ' + length()\"\n [attr.aria-describedby]=\"helpText() ? 'pin-help-text' : null\"\n [attr.aria-required]=\"true\"\n autocomplete=\"off\"\n (input)=\"onInput(i, $event)\"\n (keydown)=\"onKeyDown(i, $event)\"\n (paste)=\"onPaste($event)\"\n (focus)=\"onFocus(i)\"\n (blur)=\"onBlur(i)\"\n />\n }\n </div>\n\n @if (helpText()) {\n <div\n id=\"pin-help-text\"\n class=\"mt-small text-sm text-grayscale-60\"\n >\n {{ helpText() }}\n </div>\n }\n</div>\n\n" }]
|
|
460
|
+
}], ctorParameters: () => [] });
|
|
461
|
+
|
|
462
|
+
class PinCodeFieldModule {
|
|
463
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: PinCodeFieldModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
464
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.14", ngImport: i0, type: PinCodeFieldModule, imports: [PinCodeFieldComponent], exports: [PinCodeFieldComponent] });
|
|
465
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: PinCodeFieldModule, imports: [PinCodeFieldComponent] });
|
|
466
|
+
}
|
|
467
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: PinCodeFieldModule, decorators: [{
|
|
468
|
+
type: NgModule,
|
|
469
|
+
args: [{
|
|
470
|
+
imports: [PinCodeFieldComponent],
|
|
471
|
+
exports: [PinCodeFieldComponent],
|
|
472
|
+
}]
|
|
473
|
+
}] });
|
|
474
|
+
|
|
475
|
+
/**
|
|
476
|
+
* Generated bundle index. Do not edit.
|
|
477
|
+
*/
|
|
478
|
+
|
|
479
|
+
export { PinCodeFieldComponent, PinCodeFieldModule };
|
|
480
|
+
//# sourceMappingURL=seniorsistemas-angular-components-pin-code-field.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"seniorsistemas-angular-components-pin-code-field.mjs","sources":["../../projects/angular-components/pin-code-field/src/lib/pin-code-field/pin-code-field.component.ts","../../projects/angular-components/pin-code-field/src/lib/pin-code-field/pin-code-field.component.html","../../projects/angular-components/pin-code-field/src/lib/pin-code-field.module.ts","../../projects/angular-components/pin-code-field/src/seniorsistemas-angular-components-pin-code-field.ts"],"sourcesContent":["import {\n Component,\n forwardRef,\n viewChildren,\n ElementRef,\n signal,\n input,\n output,\n effect,\n computed,\n model,\n inject,\n DestroyRef,\n} from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';\n\n/**\n * Pin Code Field Component\n *\n * A flexible, accessible PIN code input component that implements {@link ControlValueAccessor}\n * for seamless integration with Angular Reactive Forms and Template-driven Forms.\n *\n * Features:\n * - Multiple input fields for PIN/OTP code entry\n * - Configurable code length and character validation\n * - Keyboard navigation (arrow keys, backspace)\n * - Paste support with automatic truncation\n * - Error state display via the `invalid` input\n * - Full accessibility support (ARIA labels, semantic roles)\n * - Signal-based state management\n *\n * @example\n * ```html\n * <form [formGroup]=\"form\">\n * <s-pin-code-field\n * formControlName=\"code\"\n * [length]=\"6\"\n * [alphanumeric]=\"false\"\n * [invalid]=\"(form.get('code')?.invalid && form.get('code')?.dirty) || false\"\n * helpText=\"Enter your 6-digit code\"\n * (codeFilled)=\"onCodeFilled($event)\">\n * </s-pin-code-field>\n * </form>\n * ```\n *\n * @example\n * ```typescript\n * form = this.fb.group({\n * code: ['', [Validators.required]],\n * });\n * ```\n */\n@Component({\n selector: 's-pin-code-field',\n templateUrl: './pin-code-field.component.html',\n standalone: true,\n imports: [CommonModule],\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => PinCodeFieldComponent),\n multi: true,\n },\n ],\n})\nexport class PinCodeFieldComponent implements ControlValueAccessor {\n private static readonly LAST_INDEX_OFFSET = 1;\n private static readonly EMPTY_VALUE = '';\n\n /**\n * Number of input fields (PIN code length).\n * Must be at least 1.\n *\n * @default 6\n */\n public length = input(6);\n\n /**\n * Allows alphanumeric and special characters input.\n * When false, only numeric input (0-9) is accepted.\n *\n * @default false\n */\n public alphanumeric = input(false);\n\n /**\n * Help text displayed below the input fields.\n *\n * @default ''\n */\n public helpText = input('');\n\n /**\n * Controls the error state visualization of the component.\n * When true, displays red border on input fields.\n * Typically bound to FormControl's invalid and dirty state.\n *\n * @example\n * ```html\n * [invalid]=\"(control?.invalid && control?.dirty) || false\"\n * ```\n * @default false\n */\n public invalid = input(false);\n\n /**\n * Two-way binding for the disabled state of the component.\n * Disables all input fields and prevents user interaction.\n *\n * @default false\n */\n public disabled = model(false);\n\n /**\n * Emitted when all PIN code fields are filled.\n * Emits the complete PIN code as a string.\n *\n * @example\n * ```html\n * (codeFilled)=\"onCodeFilled($event)\"\n * ```\n */\n public codeFilled = output<string>();\n\n /**\n * Signal containing the current values of each input field.\n * Array length matches the `length` input value.\n */\n public inputs = signal<string[]>([]);\n\n /**\n * Signal tracking whether the component has been touched by the user.\n * Set to true when the last input field loses focus (blur event).\n */\n public touched = signal<boolean>(false);\n\n /**\n * Computed signal indicating whether all PIN code fields are filled.\n * True only when every field contains a non-empty value.\n */\n public isComplete = computed(() => this.inputs().every((input) => input !== ''));\n\n /**\n * Computed signal containing the complete PIN code as a joined string.\n * Returns empty string if no inputs are filled.\n */\n public currentValue = computed(() => this.inputs().join(''));\n\n /**\n * Signal tracking if the component host has the ng-invalid class from FormControl validators.\n * Updated reactively whenever the invalid state changes.\n */\n private hasNgInvalidClass = signal<boolean>(false);\n\n /**\n * Signal tracking if the FormControl is dirty.\n * Updated reactively whenever the dirty state changes.\n */\n private isControlDirty = signal<boolean>(false);\n\n /**\n * Computed signal indicating if the component should show error state.\n * Returns true if:\n * - The `invalid` input is true, OR\n * - The component has the `ng-invalid` class AND the FormControl is dirty (touched/modified)\n * This ensures errors are only shown to the user after they've interacted with the field.\n */\n public hasError = computed(() =>\n this.invalid() || (this.hasNgInvalidClass() && this.isControlDirty())\n );\n\n /**\n * ViewChildren reference to all input DOM elements.\n * Used for DOM manipulation (focus, selection).\n */\n public pinInputs = viewChildren<ElementRef>('pinInput');\n\n private readonly elementRef = inject(ElementRef);\n private readonly destroyRef = inject(DestroyRef);\n\n private onChange: (value: string) => void = () => {};\n private onTouched: () => void = () => {};\n\n constructor() {\n effect(\n () => {\n const newLength = this.length();\n if (newLength < 1) {\n console.warn('PIN code length must be at least 1');\n return;\n }\n if (this.inputs().length !== newLength) {\n this.inputs.set(Array.from({ length: newLength }, () => ''));\n }\n },\n { allowSignalWrites: true },\n );\n\n // Monitor ng-invalid and ng-dirty classes on the host element for reactive error state\n effect(\n () => {\n // Access inputs to create dependency on changes\n this.inputs();\n this.invalid();\n \n // Use setTimeout to defer the check to next tick to ensure Angular has updated DOM classes\n const timeoutId = window.setTimeout(() => {\n const hostElement = this.elementRef.nativeElement;\n const hasNgInvalid = hostElement.classList.contains('ng-invalid');\n const isDirty = hostElement.classList.contains('ng-dirty');\n \n this.hasNgInvalidClass.set(hasNgInvalid);\n this.isControlDirty.set(isDirty);\n });\n\n // Cleanup timeout on component destroy\n this.destroyRef.onDestroy(() => {\n clearTimeout(timeoutId);\n });\n },\n { allowSignalWrites: true },\n );\n }\n\n /**\n * Handles input event on PIN code fields.\n * Validates character input, prevents multiple characters per field,\n * auto-advances to next field when character is entered.\n *\n * @param index - The input field index (0-based)\n * @param event - The input event\n */\n public onInput(index: number, event: Event): void {\n if (this.disabled()) {\n event.preventDefault();\n return;\n }\n\n const target = event.target as HTMLInputElement;\n const value = target.value;\n\n if (value.length > 1 || (value && !this.isValidCharacter(value))) {\n this.clearInput(target);\n return;\n }\n\n this.setInputAtIndex(index, value);\n\n if (value && index < this.length() - 1) {\n this.focusAndSelectInput(index + 1);\n }\n\n if (this.isComplete()) {\n this.codeFilled.emit(this.currentValue());\n }\n }\n\n /**\n * Handles keyboard events on PIN code fields.\n * Supports arrow navigation (left/right) and backspace key.\n *\n * Keyboard behavior:\n * - ArrowRight: Move focus to next field\n * - ArrowLeft: Move focus to previous field\n * - Backspace: Clear current or previous field and adjust focus\n *\n * @param index - The input field index (0-based)\n * @param event - The keyboard event\n */\n public onKeyDown(index: number, event: KeyboardEvent): void {\n if (this.disabled()) {\n event.preventDefault();\n return;\n }\n\n const key = event.key;\n\n switch (key) {\n case 'ArrowRight':\n if (index < this.length() - 1) {\n event.preventDefault();\n this.focusAndSelectInput(index + 1);\n }\n break;\n case 'ArrowLeft':\n if (index > 0) {\n event.preventDefault();\n this.focusAndSelectInput(index - 1);\n }\n break;\n case 'Backspace':\n event.preventDefault();\n this.handleBackspace(index);\n break;\n }\n }\n\n /**\n * Handles paste (clipboard) events on PIN code fields.\n * Extracts valid characters from pasted content, filters by character type,\n * and automatically truncates to match field length.\n *\n * Behavior:\n * - Filters characters based on `alphanumeric` setting\n * - Truncates to maximum field count\n * - Fills available fields with pasted content\n * - Emits codeFilled event if all fields are filled\n *\n * @param event - The clipboard event\n */\n public onPaste(event: ClipboardEvent): void {\n if (this.disabled()) {\n event.preventDefault();\n return;\n }\n\n event.preventDefault();\n\n const validChars = this.extractValidCharactersFromPaste(event);\n\n if (validChars.length === 0) {\n return;\n }\n\n const filledInputs = [\n ...validChars,\n ...Array(this.length() - validChars.length).fill(''),\n ];\n\n this.inputs.set(filledInputs);\n this.updateValue();\n\n // Focus on the first empty input or the last filled input if all are filled\n const firstEmptyIndex = validChars.length < this.length() ? validChars.length : validChars.length - 1;\n this.focusAndSelectInput(firstEmptyIndex);\n\n if (this.isComplete()) {\n this.codeFilled.emit(this.currentValue());\n }\n }\n\n /**\n * Handles focus event on PIN code fields.\n * Selects all text in the input field when focused.\n *\n * @param index - The input field index (0-based)\n */\n public onFocus(index: number): void {\n const input = this.pinInputs()[index];\n if (input) {\n input.nativeElement.select();\n }\n }\n\n /**\n * Handles blur event on PIN code fields.\n * Marks the component as touched when the last input field loses focus.\n * Also notifies the registered onTouched callback for FormControl integration.\n *\n * @param index - The input field index (0-based)\n */\n public onBlur(index: number): void {\n // Only mark as touched when the LAST input loses focus\n if (index === this.length() - PinCodeFieldComponent.LAST_INDEX_OFFSET) {\n this.touched.set(true);\n this.onTouched();\n }\n }\n\n /**\n * Clears the input value at specified index and adjusts focus accordingly.\n * If current field is empty, moves to previous field and clears it.\n *\n * @private\n * @param index - The input field index (0-based)\n */\n private handleBackspace(index: number): void {\n const currentInputs = this.inputs();\n \n // If current input has value, clear it\n if (currentInputs[index]) {\n this.setInputAtIndex(index, PinCodeFieldComponent.EMPTY_VALUE);\n return;\n }\n\n // Otherwise, clear previous input and focus it\n if (index > 0) {\n this.setInputAtIndex(index - 1, PinCodeFieldComponent.EMPTY_VALUE);\n this.focusAndSelectInput(index - 1);\n }\n }\n\n /**\n * Sets the value at a specific input field index and updates the form value.\n * Updates the signal and triggers the change detection via onChange callback.\n *\n * @private\n * @param index - The input field index (0-based)\n * @param value - The value to set in the field\n */\n private setInputAtIndex(index: number, value: string): void {\n const currentInputs = this.inputs();\n currentInputs[index] = value;\n this.inputs.set([...currentInputs]);\n this.updateValue();\n }\n\n /**\n * Focuses on and selects text in the input field at the specified index.\n * Uses queueMicrotask to ensure DOM is updated before focusing.\n *\n * @private\n * @param index - The input field index (0-based)\n */\n private focusAndSelectInput(index: number): void {\n queueMicrotask(() => {\n const input = this.pinInputs()[index];\n if (input) {\n input.nativeElement.focus();\n input.nativeElement.select();\n }\n });\n }\n\n /**\n * Clears the value of an input element.\n * Used for input validation to reject invalid characters.\n *\n * @private\n * @param target - The HTML input element to clear\n */\n private clearInput(target: HTMLInputElement): void {\n target.value = '';\n }\n\n /**\n * Extracts valid characters from pasted content.\n * Filters based on alphanumeric setting and limits to component's length.\n *\n * @private\n * @param event - The clipboard event\n * @returns Array of valid characters from the pasted content\n */\n private extractValidCharactersFromPaste(event: ClipboardEvent): string[] {\n const pastedText = (event.clipboardData?.getData('text') || '').trim();\n return pastedText\n .split('')\n .filter((char) => this.isValidCharacter(char))\n .slice(0, this.length());\n }\n\n /**\n * Validates if a character is acceptable based on component configuration.\n * For numeric mode, accepts only digits 0-9.\n * For alphanumeric mode, accepts any non-whitespace character.\n *\n * @private\n * @param char - The character to validate\n * @returns true if character is valid, false otherwise\n */\n private isValidCharacter(char: string): boolean {\n if (this.alphanumeric()) {\n return char.trim().length > 0;\n }\n return /^[0-9]$/.test(char);\n }\n\n /**\n * Updates the form value by calling the onChange callback registered by FormControl.\n * This ensures the reactive form stays synchronized with component state.\n *\n * @private\n */\n private updateValue(): void {\n this.onChange(this.currentValue());\n }\n\n /**\n * Implements ControlValueAccessor interface.\n * Called by the FormControl to write a value to the component.\n * Only accepts string values with length matching the component's length setting.\n *\n * @param value - The value to write (typically from the FormControl)\n */\n public writeValue(value: any): void {\n if (value) {\n const stringValue = String(value);\n if (stringValue.length === this.length()) {\n this.inputs.set(stringValue.split(''));\n }\n }\n }\n\n /**\n * Implements ControlValueAccessor interface.\n * Called by the FormControl when value changes.\n * Registers the callback to be called when the component value changes.\n *\n * @param fn - Callback function to invoke when component value changes\n */\n public registerOnChange(fn: (value: string) => void): void {\n this.onChange = fn;\n }\n\n /**\n * Implements ControlValueAccessor interface.\n * Called by the FormControl to register the touched callback.\n * The callback is invoked when the last input field loses focus.\n *\n * @param fn - Callback function to invoke when component is touched\n */\n public registerOnTouched(fn: () => void): void {\n this.onTouched = fn;\n }\n\n /**\n * Implements ControlValueAccessor interface.\n * Called by the FormControl to set the disabled state of the component.\n * Updates the disabled model to reflect the form's disabled state.\n *\n * @param isDisabled - Whether the component should be disabled\n */\n public setDisabledState(isDisabled: boolean): void {\n this.disabled.set(isDisabled);\n }\n}\n\n","<div class=\"gap-xsmall flex flex-col\">\n <div\n class=\"flex gap-2\"\n role=\"group\"\n aria-label=\"PIN code input\"\n [attr.aria-labelledby]=\"helpText() ? 'pin-help-text' : null\"\n >\n @for (input of inputs(); let i = $index; track i) {\n <input\n #pinInput\n type=\"text\"\n class=\"h-12 w-12 rounded-xbig border text-center text-lg font-medium transition-all duration-200\"\n [ngClass]=\"{\n 'border-criticality-red focus:ring-criticality-red': hasError(),\n 'border-grayscale-30 focus:border-primary focus:ring-primary': !hasError(),\n 'cursor-not-allowed bg-grayscale-10 text-grayscale-60': disabled(),\n 'bg-grayscale-0 text-grayscale-100 focus:outline-none': !disabled(),\n }\"\n [value]=\"input\"\n [disabled]=\"disabled()\"\n [attr.maxlength]=\"1\"\n [attr.inputmode]=\"alphanumeric() ? 'text' : 'numeric'\"\n [attr.aria-label]=\"'PIN code character ' + (i + 1) + ' of ' + length()\"\n [attr.aria-describedby]=\"helpText() ? 'pin-help-text' : null\"\n [attr.aria-required]=\"true\"\n autocomplete=\"off\"\n (input)=\"onInput(i, $event)\"\n (keydown)=\"onKeyDown(i, $event)\"\n (paste)=\"onPaste($event)\"\n (focus)=\"onFocus(i)\"\n (blur)=\"onBlur(i)\"\n />\n }\n </div>\n\n @if (helpText()) {\n <div\n id=\"pin-help-text\"\n class=\"mt-small text-sm text-grayscale-60\"\n >\n {{ helpText() }}\n </div>\n }\n</div>\n\n","import { NgModule } from '@angular/core';\nimport { PinCodeFieldComponent } from './pin-code-field/pin-code-field.component';\n\n@NgModule({\n imports: [PinCodeFieldComponent],\n exports: [PinCodeFieldComponent],\n})\nexport class PinCodeFieldModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;AAiBA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCG;MAcU,qBAAqB,CAAA;AACtB,IAAA,OAAgB,iBAAiB,GAAG,CAAC,CAAC;AACtC,IAAA,OAAgB,WAAW,GAAG,EAAE,CAAC;AAEzC;;;;;AAKG;AACI,IAAA,MAAM,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;AAEzB;;;;;AAKG;AACI,IAAA,YAAY,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC;AAEnC;;;;AAIG;AACI,IAAA,QAAQ,GAAG,KAAK,CAAC,EAAE,CAAC,CAAC;AAE5B;;;;;;;;;;AAUG;AACI,IAAA,OAAO,GAAG,KAAK,C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iB;AAC1B,4BAAA,WAAW,EAAE,UAAU,CAAC,2BAA2B,CAAC;AACpD,4BAAA,KAAK,EAAE,IAAI;AACd,yBAAA;AACJ,qBAAA,EAAA,QAAA,EAAA,qxDAAA,EAAA,CAAA;;;MEzDQ,kBAAkB,CAAA;wGAAlB,kBAAkB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA;yGAAlB,kBAAkB,EAAA,OAAA,EAAA,CAHjB,qBAAqB,CAAA,EAAA,OAAA,EAAA,CACrB,qBAAqB,CAAA,EAAA,CAAA,CAAA;AAEtB,IAAA,OAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,kBAAkB,YAHjB,qBAAqB,CAAA,EAAA,CAAA,CAAA;;4FAGtB,kBAAkB,EAAA,UAAA,EAAA,CAAA;kBAJ9B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;oBACN,OAAO,EAAE,CAAC,qBAAqB,CAAC;oBAChC,OAAO,EAAE,CAAC,qBAAqB,CAAC;AACnC,iBAAA,CAAA;;;ACND;;AAEG;;;;"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { FormGroup } from '@angular/forms';
|
|
2
|
+
import { FormDynamicSchema } from '../../schemas/form-dynamic-schema';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
export declare class FormDynamicComponent {
|
|
5
|
+
protected form: FormGroup<{}>;
|
|
6
|
+
schema: import("@angular/core").InputSignal<FormDynamicSchema>;
|
|
7
|
+
private readonly hosts;
|
|
8
|
+
private readonly schemaEffect;
|
|
9
|
+
private readonly hostsEffect;
|
|
10
|
+
private buildForm;
|
|
11
|
+
private buildFields;
|
|
12
|
+
emit(): void;
|
|
13
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<FormDynamicComponent, never>;
|
|
14
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<FormDynamicComponent, "s-form-dynamic", never, { "schema": { "alias": "schema"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Type } from "@angular/core";
|
|
2
|
+
import { FieldType } from "../schemas/field-dynamic";
|
|
3
|
+
export declare class FormDynamicRegistry {
|
|
4
|
+
private static fields;
|
|
5
|
+
static registerField(type: FieldType, component: Type<any>): void;
|
|
6
|
+
static resolveField(type: FieldType): Type<any> | undefined;
|
|
7
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { BooleanField } from '../../schemas/field-dynamic';
|
|
2
|
+
import { FormControl } from '@angular/forms';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
export declare class BooleanFieldComponent {
|
|
5
|
+
field: import("@angular/core").InputSignal<BooleanField>;
|
|
6
|
+
control: import("@angular/core").InputSignal<FormControl<any>>;
|
|
7
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<BooleanFieldComponent, never>;
|
|
8
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<BooleanFieldComponent, "s-boolean-field", never, { "field": { "alias": "field"; "required": true; "isSignal": true; }; "control": { "alias": "control"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { FormControl } from '@angular/forms';
|
|
2
|
+
import { StringField } from '../../schemas/field-dynamic';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
export declare class StringFieldComponent {
|
|
5
|
+
field: import("@angular/core").InputSignal<StringField>;
|
|
6
|
+
control: import("@angular/core").InputSignal<FormControl<any>>;
|
|
7
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<StringFieldComponent, never>;
|
|
8
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<StringFieldComponent, "s-string-field", never, { "field": { "alias": "field"; "required": true; "isSignal": true; }; "control": { "alias": "control"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { AfterViewInit, ElementRef } from '@angular/core';
|
|
2
|
+
import { EditorField } from '../editor-types';
|
|
3
|
+
import { FormControl } from '@angular/forms';
|
|
4
|
+
import Quill from 'quill';
|
|
5
|
+
import * as i0 from "@angular/core";
|
|
6
|
+
export declare class EditorFieldComponent implements AfterViewInit {
|
|
7
|
+
id: `${string}-${string}-${string}-${string}-${string}`;
|
|
8
|
+
field: import("@angular/core").InputSignal<EditorField>;
|
|
9
|
+
control: import("@angular/core").InputSignal<FormControl<any>>;
|
|
10
|
+
editorContainer: import("@angular/core").Signal<ElementRef<HTMLElement>>;
|
|
11
|
+
quill: Quill;
|
|
12
|
+
ngAfterViewInit(): void;
|
|
13
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<EditorFieldComponent, never>;
|
|
14
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<EditorFieldComponent, "s-editor-field", never, { "field": { "alias": "field"; "required": true; "isSignal": true; }; "control": { "alias": "control"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { FieldDynamicBase } from '@seniorsistemas/angular-components/form-dynamic';
|
|
2
|
+
export interface EditorField extends FieldDynamicBase {
|
|
3
|
+
type: 'editor';
|
|
4
|
+
key: string;
|
|
5
|
+
label?: string;
|
|
6
|
+
required?: boolean;
|
|
7
|
+
theme?: 'snow' | 'bubble';
|
|
8
|
+
}
|
|
9
|
+
declare module '@seniorsistemas/angular-components/form-dynamic' {
|
|
10
|
+
interface FieldTypeMap {
|
|
11
|
+
editor: EditorField;
|
|
12
|
+
}
|
|
13
|
+
}
|