@egose/shadcn-theme-ng-tw 0.3.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/form-autocomplete/README.md +20 -19
- package/form-autocomplete/fesm2022/form-autocomplete.mjs +47 -14
- package/form-autocomplete/types/form-autocomplete.d.ts +22 -1
- package/form-checkbox/README.md +20 -19
- package/form-checkbox/fesm2022/form-checkbox.mjs +102 -20
- package/form-checkbox/types/form-checkbox.d.ts +43 -3
- package/form-combobox/README.md +21 -20
- package/form-combobox/fesm2022/form-combobox.mjs +47 -14
- package/form-combobox/types/form-combobox.d.ts +22 -1
- package/form-date-picker/README.md +28 -27
- package/form-date-picker/fesm2022/form-date-picker.mjs +48 -20
- package/form-date-picker/types/form-date-picker.d.ts +22 -1
- package/form-date-picker-multi/README.md +28 -27
- package/form-date-picker-multi/fesm2022/form-date-picker-multi.mjs +48 -20
- package/form-date-picker-multi/types/form-date-picker-multi.d.ts +22 -1
- package/form-date-range-picker/README.md +28 -27
- package/form-date-range-picker/fesm2022/form-date-range-picker.mjs +48 -20
- package/form-date-range-picker/types/form-date-range-picker.d.ts +22 -1
- package/form-field/README.md +9 -0
- package/form-field/fesm2022/form-field.mjs +97 -5
- package/form-field/types/form-field.d.ts +96 -2
- package/form-field-simple/fesm2022/form-field-simple.mjs +15 -1
- package/form-field-simple/types/form-field-simple.d.ts +9 -2
- package/form-input-otp/README.md +17 -16
- package/form-input-otp/fesm2022/form-input-otp.mjs +46 -13
- package/form-input-otp/types/form-input-otp.d.ts +22 -1
- package/form-month-year-picker/README.md +26 -25
- package/form-month-year-picker/fesm2022/form-month-year-picker.mjs +48 -20
- package/form-month-year-picker/types/form-month-year-picker.d.ts +22 -1
- package/form-native-select/README.md +18 -17
- package/form-native-select/fesm2022/form-native-select.mjs +61 -21
- package/form-native-select/types/form-native-select.d.ts +22 -1
- package/form-phone-input/README.md +23 -22
- package/form-phone-input/fesm2022/form-phone-input.mjs +47 -19
- package/form-phone-input/types/form-phone-input.d.ts +22 -1
- package/form-radio-group/README.md +18 -17
- package/form-radio-group/fesm2022/form-radio-group.mjs +47 -19
- package/form-radio-group/types/form-radio-group.d.ts +22 -1
- package/form-searchable-multiselect/README.md +18 -17
- package/form-searchable-multiselect/fesm2022/form-searchable-multiselect.mjs +47 -19
- package/form-searchable-multiselect/types/form-searchable-multiselect.d.ts +22 -1
- package/form-select/README.md +20 -19
- package/form-select/fesm2022/form-select.mjs +47 -19
- package/form-select/types/form-select.d.ts +22 -1
- package/form-slider/README.md +19 -18
- package/form-slider/fesm2022/form-slider.mjs +46 -13
- package/form-slider/types/form-slider.d.ts +22 -1
- package/form-switch/README.md +16 -15
- package/form-switch/fesm2022/form-switch.mjs +47 -19
- package/form-switch/types/form-switch.d.ts +22 -1
- package/form-text-input/README.md +27 -26
- package/form-text-input/fesm2022/form-text-input.mjs +47 -19
- package/form-text-input/types/form-text-input.d.ts +22 -1
- package/form-textarea/README.md +23 -22
- package/form-textarea/fesm2022/form-textarea.mjs +47 -19
- package/form-textarea/types/form-textarea.d.ts +22 -1
- package/form-toggle/README.md +17 -16
- package/form-toggle/fesm2022/form-toggle.mjs +48 -11
- package/form-toggle/types/form-toggle.d.ts +22 -3
- package/form-toggle-group/README.md +20 -19
- package/form-toggle-group/fesm2022/form-toggle-group.mjs +47 -19
- package/form-toggle-group/types/form-toggle-group.d.ts +22 -1
- package/package.json +5 -1
- package/stepper/README.md +353 -0
- package/stepper/fesm2022/stepper.mjs +686 -0
- package/stepper/package.json +24 -0
- package/stepper/types/stepper.d.ts +116 -0
|
@@ -2,7 +2,7 @@ import * as i0 from '@angular/core';
|
|
|
2
2
|
import { InjectionToken, inject, input, computed, Component } from '@angular/core';
|
|
3
3
|
import * as i1 from '@angular/forms';
|
|
4
4
|
import { FormGroupDirective, ReactiveFormsModule, ControlContainer } from '@angular/forms';
|
|
5
|
-
import { HlmFormIdGenerator, HlmError, HlmHint } from '@egose/shadcn-theme-ng-tw/form-field';
|
|
5
|
+
import { injectEgFormErrorMessages, HlmFormIdGenerator, injectEgFormSharedConfig, resolveEgFormError, HlmError, HlmHint } from '@egose/shadcn-theme-ng-tw/form-field';
|
|
6
6
|
import { EgFormField } from '@egose/shadcn-theme-ng-tw/form-field-simple';
|
|
7
7
|
import { HlmLabel } from '@egose/shadcn-theme-ng-tw/label';
|
|
8
8
|
import { HlmSwitch } from '@egose/shadcn-theme-ng-tw/switch';
|
|
@@ -18,8 +18,10 @@ function injectEgFormSwitchConfig() {
|
|
|
18
18
|
|
|
19
19
|
class EgFormSwitch {
|
|
20
20
|
formGroupDirective = inject(FormGroupDirective);
|
|
21
|
+
_errorMessages = injectEgFormErrorMessages();
|
|
21
22
|
generatedId = inject(HlmFormIdGenerator).generate('eg-form-switch');
|
|
22
23
|
_config = injectEgFormSwitchConfig();
|
|
24
|
+
_shared = injectEgFormSharedConfig();
|
|
23
25
|
label = input(undefined, /* @ts-ignore */
|
|
24
26
|
...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
25
27
|
controlId = input(undefined, /* @ts-ignore */
|
|
@@ -28,6 +30,13 @@ class EgFormSwitch {
|
|
|
28
30
|
...(ngDevMode ? [{ debugName: "controlName" }] : /* istanbul ignore next */ []));
|
|
29
31
|
error = input(undefined, /* @ts-ignore */
|
|
30
32
|
...(ngDevMode ? [{ debugName: "error" }] : /* istanbul ignore next */ []));
|
|
33
|
+
/**
|
|
34
|
+
* Auto-resolve the displayed message from the control's `ValidationErrors`
|
|
35
|
+
* when `error()` is unset. Explicit `error()` always wins. Set to `false`
|
|
36
|
+
* for manual-only messages.
|
|
37
|
+
*/
|
|
38
|
+
autoError = input(true, /* @ts-ignore */
|
|
39
|
+
...(ngDevMode ? [{ debugName: "autoError" }] : /* istanbul ignore next */ []));
|
|
31
40
|
hint = input(undefined, /* @ts-ignore */
|
|
32
41
|
...(ngDevMode ? [{ debugName: "hint" }] : /* istanbul ignore next */ []));
|
|
33
42
|
id = input(undefined, /* @ts-ignore */
|
|
@@ -42,13 +51,34 @@ class EgFormSwitch {
|
|
|
42
51
|
...(ngDevMode ? [{ debugName: "errorId" }] : /* istanbul ignore next */ []));
|
|
43
52
|
hintId = computed(() => `${this.effectiveId()}-hint`, /* @ts-ignore */
|
|
44
53
|
...(ngDevMode ? [{ debugName: "hintId" }] : /* istanbul ignore next */ []));
|
|
45
|
-
|
|
54
|
+
/**
|
|
55
|
+
* Displayed message: explicit `error()` wins; otherwise (when `autoError()`)
|
|
56
|
+
* auto-resolved from the control's `ValidationErrors`. Plain method (not a
|
|
57
|
+
* computed): `ValidationErrors` is not a signal, so the control must be read
|
|
58
|
+
* fresh on every change-detection pass.
|
|
59
|
+
*/
|
|
60
|
+
resolvedError() {
|
|
61
|
+
const explicit = this.error();
|
|
62
|
+
if (explicit)
|
|
63
|
+
return explicit;
|
|
64
|
+
if (!this.autoError())
|
|
65
|
+
return undefined;
|
|
66
|
+
const control = this.formGroupDirective.form.get(this.controlName());
|
|
67
|
+
return resolveEgFormError(control?.errors ?? null, this.label(), this._errorMessages);
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Whether the error is surfaced: message present + control invalid +
|
|
71
|
+
* touched/dirty/submitted. Gates the visual `<hlm-error>` (and
|
|
72
|
+
* `describedBy()`, where present) so sighted and screen-reader output agree.
|
|
73
|
+
*/
|
|
74
|
+
showError() {
|
|
46
75
|
const control = this.formGroupDirective.form.get(this.controlName());
|
|
47
|
-
return this.
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
76
|
+
return (!!this.resolvedError() &&
|
|
77
|
+
!!control?.invalid &&
|
|
78
|
+
(control.dirty || control.touched || this.formGroupDirective.submitted));
|
|
79
|
+
}
|
|
80
|
+
describedBy() {
|
|
81
|
+
return this.showError() ? this.errorId() : this.hint() ? this.hintId() : null;
|
|
52
82
|
}
|
|
53
83
|
// Styling
|
|
54
84
|
userClass = input('', { ...(ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {}), alias: 'class' });
|
|
@@ -63,19 +93,18 @@ class EgFormSwitch {
|
|
|
63
93
|
// Computed classes (library base < global config < per-instance)
|
|
64
94
|
$userClass = computed(() => hlm('tw:w-full', this.userClass()), /* @ts-ignore */
|
|
65
95
|
...(ngDevMode ? [{ debugName: "$userClass" }] : /* istanbul ignore next */ []));
|
|
66
|
-
$switchClass = computed(() => hlm(this._config.switchClass, this.switchClass()), /* @ts-ignore */
|
|
96
|
+
$switchClass = computed(() => hlm(this._shared.switchClass, this._config.switchClass, this.switchClass()), /* @ts-ignore */
|
|
67
97
|
...(ngDevMode ? [{ debugName: "$switchClass" }] : /* istanbul ignore next */ []));
|
|
68
|
-
$labelClass = computed(() => hlm(this._config.labelClass, this.labelClass()), /* @ts-ignore */
|
|
98
|
+
$labelClass = computed(() => hlm(this._shared.labelClass, this._config.labelClass, this.labelClass()), /* @ts-ignore */
|
|
69
99
|
...(ngDevMode ? [{ debugName: "$labelClass" }] : /* istanbul ignore next */ []));
|
|
70
|
-
$errorClass = computed(() => hlm('tw:mt-0', this._config.errorClass, this.errorClass()), /* @ts-ignore */
|
|
100
|
+
$errorClass = computed(() => hlm('tw:mt-0', this._shared.errorClass, this._config.errorClass, this.errorClass()), /* @ts-ignore */
|
|
71
101
|
...(ngDevMode ? [{ debugName: "$errorClass" }] : /* istanbul ignore next */ []));
|
|
72
|
-
$hintClass = computed(() => hlm('tw:mt-0', this._config.hintClass, this.hintClass()), /* @ts-ignore */
|
|
102
|
+
$hintClass = computed(() => hlm('tw:mt-0', this._shared.hintClass, this._config.hintClass, this.hintClass()), /* @ts-ignore */
|
|
73
103
|
...(ngDevMode ? [{ debugName: "$hintClass" }] : /* istanbul ignore next */ []));
|
|
74
104
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: EgFormSwitch, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
75
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.3", type: EgFormSwitch, isStandalone: true, selector: "eg-form-switch", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, controlId: { classPropertyName: "controlId", publicName: "controlId", isSignal: true, isRequired: false, transformFunction: null }, controlName: { classPropertyName: "controlName", publicName: "controlName", isSignal: true, isRequired: false, transformFunction: null }, error: { classPropertyName: "error", publicName: "error", isSignal: true, isRequired: false, transformFunction: null }, hint: { classPropertyName: "hint", publicName: "hint", isSignal: true, isRequired: false, transformFunction: null }, id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, userClass: { classPropertyName: "userClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, switchClass: { classPropertyName: "switchClass", publicName: "switchClass", isSignal: true, isRequired: false, transformFunction: null }, labelClass: { classPropertyName: "labelClass", publicName: "labelClass", isSignal: true, isRequired: false, transformFunction: null }, errorClass: { classPropertyName: "errorClass", publicName: "errorClass", isSignal: true, isRequired: false, transformFunction: null }, hintClass: { classPropertyName: "hintClass", publicName: "hintClass", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "$userClass()" } }, providers: [{ provide: ControlContainer, useExisting: FormGroupDirective }], ngImport: i0, template: `
|
|
105
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.3", type: EgFormSwitch, isStandalone: true, selector: "eg-form-switch", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, controlId: { classPropertyName: "controlId", publicName: "controlId", isSignal: true, isRequired: false, transformFunction: null }, controlName: { classPropertyName: "controlName", publicName: "controlName", isSignal: true, isRequired: false, transformFunction: null }, error: { classPropertyName: "error", publicName: "error", isSignal: true, isRequired: false, transformFunction: null }, autoError: { classPropertyName: "autoError", publicName: "autoError", isSignal: true, isRequired: false, transformFunction: null }, hint: { classPropertyName: "hint", publicName: "hint", isSignal: true, isRequired: false, transformFunction: null }, id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, userClass: { classPropertyName: "userClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, switchClass: { classPropertyName: "switchClass", publicName: "switchClass", isSignal: true, isRequired: false, transformFunction: null }, labelClass: { classPropertyName: "labelClass", publicName: "labelClass", isSignal: true, isRequired: false, transformFunction: null }, errorClass: { classPropertyName: "errorClass", publicName: "errorClass", isSignal: true, isRequired: false, transformFunction: null }, hintClass: { classPropertyName: "hintClass", publicName: "hintClass", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "$userClass()" } }, providers: [{ provide: ControlContainer, useExisting: FormGroupDirective }], ngImport: i0, template: `
|
|
76
106
|
@let lbl = label();
|
|
77
107
|
@let cnm = controlName();
|
|
78
|
-
@let err = error();
|
|
79
108
|
@let hnt = hint();
|
|
80
109
|
@let rqrd = required();
|
|
81
110
|
|
|
@@ -99,9 +128,9 @@ class EgFormSwitch {
|
|
|
99
128
|
}
|
|
100
129
|
</div>
|
|
101
130
|
|
|
102
|
-
@if (
|
|
131
|
+
@if (showError()) {
|
|
103
132
|
<hlm-error [id]="errorId()" [class]="$errorClass()">
|
|
104
|
-
{{
|
|
133
|
+
{{ resolvedError() }}
|
|
105
134
|
</hlm-error>
|
|
106
135
|
}
|
|
107
136
|
|
|
@@ -126,7 +155,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImpor
|
|
|
126
155
|
template: `
|
|
127
156
|
@let lbl = label();
|
|
128
157
|
@let cnm = controlName();
|
|
129
|
-
@let err = error();
|
|
130
158
|
@let hnt = hint();
|
|
131
159
|
@let rqrd = required();
|
|
132
160
|
|
|
@@ -150,9 +178,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImpor
|
|
|
150
178
|
}
|
|
151
179
|
</div>
|
|
152
180
|
|
|
153
|
-
@if (
|
|
181
|
+
@if (showError()) {
|
|
154
182
|
<hlm-error [id]="errorId()" [class]="$errorClass()">
|
|
155
|
-
{{
|
|
183
|
+
{{ resolvedError() }}
|
|
156
184
|
</hlm-error>
|
|
157
185
|
}
|
|
158
186
|
|
|
@@ -164,7 +192,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImpor
|
|
|
164
192
|
</eg-form-field>
|
|
165
193
|
`,
|
|
166
194
|
}]
|
|
167
|
-
}], propDecorators: { label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], controlId: [{ type: i0.Input, args: [{ isSignal: true, alias: "controlId", required: false }] }], controlName: [{ type: i0.Input, args: [{ isSignal: true, alias: "controlName", required: false }] }], error: [{ type: i0.Input, args: [{ isSignal: true, alias: "error", required: false }] }], hint: [{ type: i0.Input, args: [{ isSignal: true, alias: "hint", required: false }] }], id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }], userClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], switchClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "switchClass", required: false }] }], labelClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "labelClass", required: false }] }], errorClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "errorClass", required: false }] }], hintClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "hintClass", required: false }] }] } });
|
|
195
|
+
}], propDecorators: { label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], controlId: [{ type: i0.Input, args: [{ isSignal: true, alias: "controlId", required: false }] }], controlName: [{ type: i0.Input, args: [{ isSignal: true, alias: "controlName", required: false }] }], error: [{ type: i0.Input, args: [{ isSignal: true, alias: "error", required: false }] }], autoError: [{ type: i0.Input, args: [{ isSignal: true, alias: "autoError", required: false }] }], hint: [{ type: i0.Input, args: [{ isSignal: true, alias: "hint", required: false }] }], id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }], userClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], switchClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "switchClass", required: false }] }], labelClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "labelClass", required: false }] }], errorClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "errorClass", required: false }] }], hintClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "hintClass", required: false }] }] } });
|
|
168
196
|
|
|
169
197
|
/*
|
|
170
198
|
* Public API Surface of form-switch
|
|
@@ -4,12 +4,20 @@ import { ClassValue } from 'clsx';
|
|
|
4
4
|
|
|
5
5
|
declare class EgFormSwitch {
|
|
6
6
|
private readonly formGroupDirective;
|
|
7
|
+
private readonly _errorMessages;
|
|
7
8
|
private readonly generatedId;
|
|
8
9
|
private readonly _config;
|
|
10
|
+
private readonly _shared;
|
|
9
11
|
label: _angular_core.InputSignal<string | undefined>;
|
|
10
12
|
controlId: _angular_core.InputSignal<string | undefined>;
|
|
11
13
|
controlName: _angular_core.InputSignal<string>;
|
|
12
14
|
error: _angular_core.InputSignal<string | undefined>;
|
|
15
|
+
/**
|
|
16
|
+
* Auto-resolve the displayed message from the control's `ValidationErrors`
|
|
17
|
+
* when `error()` is unset. Explicit `error()` always wins. Set to `false`
|
|
18
|
+
* for manual-only messages.
|
|
19
|
+
*/
|
|
20
|
+
autoError: _angular_core.InputSignal<boolean>;
|
|
13
21
|
hint: _angular_core.InputSignal<string | undefined>;
|
|
14
22
|
id: _angular_core.InputSignal<string | undefined>;
|
|
15
23
|
disabled: _angular_core.InputSignal<boolean>;
|
|
@@ -17,6 +25,19 @@ declare class EgFormSwitch {
|
|
|
17
25
|
readonly effectiveId: _angular_core.Signal<string>;
|
|
18
26
|
readonly errorId: _angular_core.Signal<string>;
|
|
19
27
|
readonly hintId: _angular_core.Signal<string>;
|
|
28
|
+
/**
|
|
29
|
+
* Displayed message: explicit `error()` wins; otherwise (when `autoError()`)
|
|
30
|
+
* auto-resolved from the control's `ValidationErrors`. Plain method (not a
|
|
31
|
+
* computed): `ValidationErrors` is not a signal, so the control must be read
|
|
32
|
+
* fresh on every change-detection pass.
|
|
33
|
+
*/
|
|
34
|
+
protected resolvedError(): string | undefined;
|
|
35
|
+
/**
|
|
36
|
+
* Whether the error is surfaced: message present + control invalid +
|
|
37
|
+
* touched/dirty/submitted. Gates the visual `<hlm-error>` (and
|
|
38
|
+
* `describedBy()`, where present) so sighted and screen-reader output agree.
|
|
39
|
+
*/
|
|
40
|
+
protected showError(): boolean;
|
|
20
41
|
describedBy(): string | null;
|
|
21
42
|
userClass: _angular_core.InputSignal<ClassValue>;
|
|
22
43
|
switchClass: _angular_core.InputSignal<string>;
|
|
@@ -29,7 +50,7 @@ declare class EgFormSwitch {
|
|
|
29
50
|
$errorClass: _angular_core.Signal<string>;
|
|
30
51
|
$hintClass: _angular_core.Signal<string>;
|
|
31
52
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<EgFormSwitch, never>;
|
|
32
|
-
static ɵcmp: _angular_core.ɵɵComponentDeclaration<EgFormSwitch, "eg-form-switch", never, { "label": { "alias": "label"; "required": false; "isSignal": true; }; "controlId": { "alias": "controlId"; "required": false; "isSignal": true; }; "controlName": { "alias": "controlName"; "required": false; "isSignal": true; }; "error": { "alias": "error"; "required": false; "isSignal": true; }; "hint": { "alias": "hint"; "required": false; "isSignal": true; }; "id": { "alias": "id"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "required": { "alias": "required"; "required": false; "isSignal": true; }; "userClass": { "alias": "class"; "required": false; "isSignal": true; }; "switchClass": { "alias": "switchClass"; "required": false; "isSignal": true; }; "labelClass": { "alias": "labelClass"; "required": false; "isSignal": true; }; "errorClass": { "alias": "errorClass"; "required": false; "isSignal": true; }; "hintClass": { "alias": "hintClass"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
53
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<EgFormSwitch, "eg-form-switch", never, { "label": { "alias": "label"; "required": false; "isSignal": true; }; "controlId": { "alias": "controlId"; "required": false; "isSignal": true; }; "controlName": { "alias": "controlName"; "required": false; "isSignal": true; }; "error": { "alias": "error"; "required": false; "isSignal": true; }; "autoError": { "alias": "autoError"; "required": false; "isSignal": true; }; "hint": { "alias": "hint"; "required": false; "isSignal": true; }; "id": { "alias": "id"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "required": { "alias": "required"; "required": false; "isSignal": true; }; "userClass": { "alias": "class"; "required": false; "isSignal": true; }; "switchClass": { "alias": "switchClass"; "required": false; "isSignal": true; }; "labelClass": { "alias": "labelClass"; "required": false; "isSignal": true; }; "errorClass": { "alias": "errorClass"; "required": false; "isSignal": true; }; "hintClass": { "alias": "hintClass"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
33
54
|
}
|
|
34
55
|
|
|
35
56
|
interface EgFormSwitchConfig {
|
|
@@ -75,32 +75,33 @@ Real selectors: `eg-form-text-input`, `hlm-form-field`, `label[hlmLabel]`, `inpu
|
|
|
75
75
|
|
|
76
76
|
### `eg-form-text-input` — `EgFormTextInput`
|
|
77
77
|
|
|
78
|
-
| Input | Type | Default | Description
|
|
79
|
-
| --------------------- | -------------------------- | ----------- |
|
|
80
|
-
| `label` | `string \| undefined` | `undefined` | Field label rendered as `<label hlmLabel>` bound to the input id.
|
|
81
|
-
| `controlName` | `string` | `''` | **Required.** Control name in the parent `FormGroup`; forwarded as `formControlName` and `name`.
|
|
82
|
-
| `controlId` | `string \| undefined` | `undefined` | Explicit id; falls back to `id`, then generated `eg-form-text-input-…`.
|
|
83
|
-
| `id` | `string \| undefined` | `undefined` | Alias for an explicit id (same fallback chain).
|
|
84
|
-
| `error` | `string \| undefined` | `undefined` | Error text rendered in `<hlm-error>`.
|
|
85
|
-
| `
|
|
86
|
-
| `
|
|
87
|
-
| `
|
|
88
|
-
| `
|
|
89
|
-
| `
|
|
90
|
-
| `
|
|
91
|
-
| `
|
|
92
|
-
| `
|
|
93
|
-
| `
|
|
94
|
-
| `
|
|
95
|
-
| `
|
|
96
|
-
| `
|
|
97
|
-
| `
|
|
98
|
-
| `
|
|
99
|
-
| `
|
|
100
|
-
| `
|
|
101
|
-
| `
|
|
102
|
-
| `
|
|
103
|
-
| `
|
|
78
|
+
| Input | Type | Default | Description |
|
|
79
|
+
| --------------------- | -------------------------- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
80
|
+
| `label` | `string \| undefined` | `undefined` | Field label rendered as `<label hlmLabel>` bound to the input id. |
|
|
81
|
+
| `controlName` | `string` | `''` | **Required.** Control name in the parent `FormGroup`; forwarded as `formControlName` and `name`. |
|
|
82
|
+
| `controlId` | `string \| undefined` | `undefined` | Explicit id; falls back to `id`, then generated `eg-form-text-input-…`. |
|
|
83
|
+
| `id` | `string \| undefined` | `undefined` | Alias for an explicit id (same fallback chain). |
|
|
84
|
+
| `error` | `string \| undefined` | `undefined` | Error text rendered in `<hlm-error>`. |
|
|
85
|
+
| `autoError` | `boolean` | `true` | Auto-resolve the message from the control's `ValidationErrors` when `error` is unset. Explicit `error` always wins; `error=""` counts as unset. Global wording via `provideEgFormErrorMessages`. |
|
|
86
|
+
| `hint` | `string \| undefined` | `undefined` | Hint text rendered in `<hlm-hint>`. |
|
|
87
|
+
| `name` | `string \| undefined` | `undefined` | `name` attribute fallback when `controlName` is empty. |
|
|
88
|
+
| `type` | `string` | `'text'` | Native input `type` (`text`, `email`, `password`, `number`, `tel`, `url`, …). |
|
|
89
|
+
| `placeholder` | `string` | `''` | Placeholder text. |
|
|
90
|
+
| `readonly` | `boolean` | `false` | Native `readonly` attribute. |
|
|
91
|
+
| `disabled` | `boolean` | `false` | Wrapper-level disable (OR-ed with the reactive disabled state — see `effectiveDisabled()`). |
|
|
92
|
+
| `maxlength` | `string \| number \| null` | `null` | Native `maxlength`. |
|
|
93
|
+
| `minlength` | `string \| number \| null` | `null` | Native `minlength`. |
|
|
94
|
+
| `max` | `string \| number \| null` | `null` | Native `max` (number/date inputs). |
|
|
95
|
+
| `min` | `string \| number \| null` | `null` | Native `min` (number/date inputs). |
|
|
96
|
+
| `pattern` | `string \| RegExp` | `''` | Native `pattern` attribute. |
|
|
97
|
+
| `autocomplete` | `string \| undefined` | `undefined` | Native `autocomplete` (e.g. `email`, `current-password`). |
|
|
98
|
+
| `autofocus` | `boolean` | `false` | Native `autofocus`. |
|
|
99
|
+
| `required` | `boolean` | `false` | Native `required` + red `*` on the label. |
|
|
100
|
+
| `class` (`userClass`) | `ClassValue` | `''` | Extra host classes (merged over `tw:flex tw:flex-col`). |
|
|
101
|
+
| `labelClass` | `string` | `''` | Extra label classes (merged over `tw:mb-1 tw:gap-0`). |
|
|
102
|
+
| `inputClass` | `string` | `''` | Extra input classes (merged over `tw:mb-1`). |
|
|
103
|
+
| `errorClass` | `string` | `''` | Extra error classes (merged over `tw:mt-0`). |
|
|
104
|
+
| `hintClass` | `string` | `''` | Extra hint classes (merged over `tw:mt-0`). |
|
|
104
105
|
|
|
105
106
|
No outputs. Methods: `describedBy(): string | null` (error id when invalid + dirty/touched, else hint id, else `null`); `effectiveDisabled(): boolean` (`disabled()` OR the control's reactive disabled state — bound as the native `disabled` attribute). Readonly computeds: `effectiveId()`, `errorId()`, `hintId()`.
|
|
106
107
|
|
|
@@ -2,7 +2,7 @@ import * as i0 from '@angular/core';
|
|
|
2
2
|
import { InjectionToken, inject, input, computed, Component } from '@angular/core';
|
|
3
3
|
import * as i1 from '@angular/forms';
|
|
4
4
|
import { FormGroupDirective, ReactiveFormsModule, ControlContainer } from '@angular/forms';
|
|
5
|
-
import { HlmFormIdGenerator, HlmFormField, HlmError, HlmHint } from '@egose/shadcn-theme-ng-tw/form-field';
|
|
5
|
+
import { injectEgFormErrorMessages, HlmFormIdGenerator, injectEgFormSharedConfig, resolveEgFormError, HlmFormField, HlmError, HlmHint } from '@egose/shadcn-theme-ng-tw/form-field';
|
|
6
6
|
import { HlmLabel } from '@egose/shadcn-theme-ng-tw/label';
|
|
7
7
|
import { HlmInput } from '@egose/shadcn-theme-ng-tw/input';
|
|
8
8
|
import { hlm } from '@egose/shadcn-theme-ng-tw/utils';
|
|
@@ -17,8 +17,10 @@ function injectEgFormTextInputConfig() {
|
|
|
17
17
|
|
|
18
18
|
class EgFormTextInput {
|
|
19
19
|
formGroupDirective = inject(FormGroupDirective);
|
|
20
|
+
_errorMessages = injectEgFormErrorMessages();
|
|
20
21
|
generatedId = inject(HlmFormIdGenerator).generate('eg-form-text-input');
|
|
21
22
|
_config = injectEgFormTextInputConfig();
|
|
23
|
+
_shared = injectEgFormSharedConfig();
|
|
22
24
|
label = input(undefined, /* @ts-ignore */
|
|
23
25
|
...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
24
26
|
controlId = input(undefined, /* @ts-ignore */
|
|
@@ -27,6 +29,13 @@ class EgFormTextInput {
|
|
|
27
29
|
...(ngDevMode ? [{ debugName: "controlName" }] : /* istanbul ignore next */ []));
|
|
28
30
|
error = input(undefined, /* @ts-ignore */
|
|
29
31
|
...(ngDevMode ? [{ debugName: "error" }] : /* istanbul ignore next */ []));
|
|
32
|
+
/**
|
|
33
|
+
* Auto-resolve the displayed message from the control's `ValidationErrors`
|
|
34
|
+
* when `error()` is unset. Explicit `error()` always wins. Set to `false`
|
|
35
|
+
* for manual-only messages.
|
|
36
|
+
*/
|
|
37
|
+
autoError = input(true, /* @ts-ignore */
|
|
38
|
+
...(ngDevMode ? [{ debugName: "autoError" }] : /* istanbul ignore next */ []));
|
|
30
39
|
hint = input(undefined, /* @ts-ignore */
|
|
31
40
|
...(ngDevMode ? [{ debugName: "hint" }] : /* istanbul ignore next */ []));
|
|
32
41
|
// HTML/input attributes
|
|
@@ -64,13 +73,34 @@ class EgFormTextInput {
|
|
|
64
73
|
...(ngDevMode ? [{ debugName: "errorId" }] : /* istanbul ignore next */ []));
|
|
65
74
|
hintId = computed(() => `${this.effectiveId()}-hint`, /* @ts-ignore */
|
|
66
75
|
...(ngDevMode ? [{ debugName: "hintId" }] : /* istanbul ignore next */ []));
|
|
67
|
-
|
|
76
|
+
/**
|
|
77
|
+
* Displayed message: explicit `error()` wins; otherwise (when `autoError()`)
|
|
78
|
+
* auto-resolved from the control's `ValidationErrors`. Plain method (not a
|
|
79
|
+
* computed): `ValidationErrors` is not a signal, so the control must be read
|
|
80
|
+
* fresh on every change-detection pass.
|
|
81
|
+
*/
|
|
82
|
+
resolvedError() {
|
|
83
|
+
const explicit = this.error();
|
|
84
|
+
if (explicit)
|
|
85
|
+
return explicit;
|
|
86
|
+
if (!this.autoError())
|
|
87
|
+
return undefined;
|
|
88
|
+
const control = this.formGroupDirective.form.get(this.controlName());
|
|
89
|
+
return resolveEgFormError(control?.errors ?? null, this.label(), this._errorMessages);
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Whether the error is surfaced: message present + control invalid +
|
|
93
|
+
* touched/dirty/submitted. Gates the visual `<hlm-error>` (and
|
|
94
|
+
* `describedBy()`, where present) so sighted and screen-reader output agree.
|
|
95
|
+
*/
|
|
96
|
+
showError() {
|
|
68
97
|
const control = this.formGroupDirective.form.get(this.controlName());
|
|
69
|
-
return this.
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
98
|
+
return (!!this.resolvedError() &&
|
|
99
|
+
!!control?.invalid &&
|
|
100
|
+
(control.dirty || control.touched || this.formGroupDirective.submitted));
|
|
101
|
+
}
|
|
102
|
+
describedBy() {
|
|
103
|
+
return this.showError() ? this.errorId() : this.hint() ? this.hintId() : null;
|
|
74
104
|
}
|
|
75
105
|
effectiveDisabled() {
|
|
76
106
|
return this.disabled() || !!this.formGroupDirective.form.get(this.controlName())?.disabled;
|
|
@@ -88,19 +118,18 @@ class EgFormTextInput {
|
|
|
88
118
|
// Computed class bindings (library base < global config < per-instance)
|
|
89
119
|
$userClass = computed(() => hlm('tw:w-full', this.userClass()), /* @ts-ignore */
|
|
90
120
|
...(ngDevMode ? [{ debugName: "$userClass" }] : /* istanbul ignore next */ []));
|
|
91
|
-
$labelClass = computed(() => hlm('tw:mb-1 tw:gap-0', this._config.labelClass, this.labelClass()), /* @ts-ignore */
|
|
121
|
+
$labelClass = computed(() => hlm('tw:mb-1 tw:gap-0', this._shared.labelClass, this._config.labelClass, this.labelClass()), /* @ts-ignore */
|
|
92
122
|
...(ngDevMode ? [{ debugName: "$labelClass" }] : /* istanbul ignore next */ []));
|
|
93
|
-
$inputClass = computed(() => hlm('tw:mb-1', this._config.inputClass, this.inputClass()), /* @ts-ignore */
|
|
123
|
+
$inputClass = computed(() => hlm('tw:mb-1', this._shared.inputClass, this._config.inputClass, this.inputClass()), /* @ts-ignore */
|
|
94
124
|
...(ngDevMode ? [{ debugName: "$inputClass" }] : /* istanbul ignore next */ []));
|
|
95
|
-
$errorClass = computed(() => hlm('tw:mt-0', this._config.errorClass, this.errorClass()), /* @ts-ignore */
|
|
125
|
+
$errorClass = computed(() => hlm('tw:mt-0', this._shared.errorClass, this._config.errorClass, this.errorClass()), /* @ts-ignore */
|
|
96
126
|
...(ngDevMode ? [{ debugName: "$errorClass" }] : /* istanbul ignore next */ []));
|
|
97
|
-
$hintClass = computed(() => hlm('tw:mt-0', this._config.hintClass, this.hintClass()), /* @ts-ignore */
|
|
127
|
+
$hintClass = computed(() => hlm('tw:mt-0', this._shared.hintClass, this._config.hintClass, this.hintClass()), /* @ts-ignore */
|
|
98
128
|
...(ngDevMode ? [{ debugName: "$hintClass" }] : /* istanbul ignore next */ []));
|
|
99
129
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: EgFormTextInput, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
100
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.3", type: EgFormTextInput, isStandalone: true, selector: "eg-form-text-input", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, controlId: { classPropertyName: "controlId", publicName: "controlId", isSignal: true, isRequired: false, transformFunction: null }, controlName: { classPropertyName: "controlName", publicName: "controlName", isSignal: true, isRequired: false, transformFunction: null }, error: { classPropertyName: "error", publicName: "error", isSignal: true, isRequired: false, transformFunction: null }, hint: { classPropertyName: "hint", publicName: "hint", isSignal: true, isRequired: false, transformFunction: null }, id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, maxlength: { classPropertyName: "maxlength", publicName: "maxlength", isSignal: true, isRequired: false, transformFunction: null }, minlength: { classPropertyName: "minlength", publicName: "minlength", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, min: { classPropertyName: "min", publicName: "min", isSignal: true, isRequired: false, transformFunction: null }, pattern: { classPropertyName: "pattern", publicName: "pattern", isSignal: true, isRequired: false, transformFunction: null }, autocomplete: { classPropertyName: "autocomplete", publicName: "autocomplete", isSignal: true, isRequired: false, transformFunction: null }, autofocus: { classPropertyName: "autofocus", publicName: "autofocus", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, userClass: { classPropertyName: "userClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, labelClass: { classPropertyName: "labelClass", publicName: "labelClass", isSignal: true, isRequired: false, transformFunction: null }, inputClass: { classPropertyName: "inputClass", publicName: "inputClass", isSignal: true, isRequired: false, transformFunction: null }, errorClass: { classPropertyName: "errorClass", publicName: "errorClass", isSignal: true, isRequired: false, transformFunction: null }, hintClass: { classPropertyName: "hintClass", publicName: "hintClass", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "$userClass()" } }, providers: [{ provide: ControlContainer, useExisting: FormGroupDirective }], ngImport: i0, template: `
|
|
130
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.3", type: EgFormTextInput, isStandalone: true, selector: "eg-form-text-input", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, controlId: { classPropertyName: "controlId", publicName: "controlId", isSignal: true, isRequired: false, transformFunction: null }, controlName: { classPropertyName: "controlName", publicName: "controlName", isSignal: true, isRequired: false, transformFunction: null }, error: { classPropertyName: "error", publicName: "error", isSignal: true, isRequired: false, transformFunction: null }, autoError: { classPropertyName: "autoError", publicName: "autoError", isSignal: true, isRequired: false, transformFunction: null }, hint: { classPropertyName: "hint", publicName: "hint", isSignal: true, isRequired: false, transformFunction: null }, id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, maxlength: { classPropertyName: "maxlength", publicName: "maxlength", isSignal: true, isRequired: false, transformFunction: null }, minlength: { classPropertyName: "minlength", publicName: "minlength", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, min: { classPropertyName: "min", publicName: "min", isSignal: true, isRequired: false, transformFunction: null }, pattern: { classPropertyName: "pattern", publicName: "pattern", isSignal: true, isRequired: false, transformFunction: null }, autocomplete: { classPropertyName: "autocomplete", publicName: "autocomplete", isSignal: true, isRequired: false, transformFunction: null }, autofocus: { classPropertyName: "autofocus", publicName: "autofocus", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, userClass: { classPropertyName: "userClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, labelClass: { classPropertyName: "labelClass", publicName: "labelClass", isSignal: true, isRequired: false, transformFunction: null }, inputClass: { classPropertyName: "inputClass", publicName: "inputClass", isSignal: true, isRequired: false, transformFunction: null }, errorClass: { classPropertyName: "errorClass", publicName: "errorClass", isSignal: true, isRequired: false, transformFunction: null }, hintClass: { classPropertyName: "hintClass", publicName: "hintClass", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "$userClass()" } }, providers: [{ provide: ControlContainer, useExisting: FormGroupDirective }], ngImport: i0, template: `
|
|
101
131
|
@let lbl = label();
|
|
102
132
|
@let cnm = controlName();
|
|
103
|
-
@let err = error();
|
|
104
133
|
@let hnt = hint();
|
|
105
134
|
@let rqrd = required();
|
|
106
135
|
|
|
@@ -136,9 +165,9 @@ class EgFormTextInput {
|
|
|
136
165
|
[required]="rqrd"
|
|
137
166
|
/>
|
|
138
167
|
|
|
139
|
-
@if (
|
|
168
|
+
@if (showError()) {
|
|
140
169
|
<hlm-error [id]="errorId()" [class]="$errorClass()">
|
|
141
|
-
{{
|
|
170
|
+
{{ resolvedError() }}
|
|
142
171
|
</hlm-error>
|
|
143
172
|
}
|
|
144
173
|
|
|
@@ -163,7 +192,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImpor
|
|
|
163
192
|
template: `
|
|
164
193
|
@let lbl = label();
|
|
165
194
|
@let cnm = controlName();
|
|
166
|
-
@let err = error();
|
|
167
195
|
@let hnt = hint();
|
|
168
196
|
@let rqrd = required();
|
|
169
197
|
|
|
@@ -199,9 +227,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImpor
|
|
|
199
227
|
[required]="rqrd"
|
|
200
228
|
/>
|
|
201
229
|
|
|
202
|
-
@if (
|
|
230
|
+
@if (showError()) {
|
|
203
231
|
<hlm-error [id]="errorId()" [class]="$errorClass()">
|
|
204
|
-
{{
|
|
232
|
+
{{ resolvedError() }}
|
|
205
233
|
</hlm-error>
|
|
206
234
|
}
|
|
207
235
|
|
|
@@ -213,7 +241,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImpor
|
|
|
213
241
|
</hlm-form-field>
|
|
214
242
|
`,
|
|
215
243
|
}]
|
|
216
|
-
}], propDecorators: { label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], controlId: [{ type: i0.Input, args: [{ isSignal: true, alias: "controlId", required: false }] }], controlName: [{ type: i0.Input, args: [{ isSignal: true, alias: "controlName", required: false }] }], error: [{ type: i0.Input, args: [{ isSignal: true, alias: "error", required: false }] }], hint: [{ type: i0.Input, args: [{ isSignal: true, alias: "hint", required: false }] }], id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], name: [{ type: i0.Input, args: [{ isSignal: true, alias: "name", required: false }] }], type: [{ type: i0.Input, args: [{ isSignal: true, alias: "type", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], maxlength: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxlength", required: false }] }], minlength: [{ type: i0.Input, args: [{ isSignal: true, alias: "minlength", required: false }] }], max: [{ type: i0.Input, args: [{ isSignal: true, alias: "max", required: false }] }], min: [{ type: i0.Input, args: [{ isSignal: true, alias: "min", required: false }] }], pattern: [{ type: i0.Input, args: [{ isSignal: true, alias: "pattern", required: false }] }], autocomplete: [{ type: i0.Input, args: [{ isSignal: true, alias: "autocomplete", required: false }] }], autofocus: [{ type: i0.Input, args: [{ isSignal: true, alias: "autofocus", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }], userClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], labelClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "labelClass", required: false }] }], inputClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "inputClass", required: false }] }], errorClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "errorClass", required: false }] }], hintClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "hintClass", required: false }] }] } });
|
|
244
|
+
}], propDecorators: { label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], controlId: [{ type: i0.Input, args: [{ isSignal: true, alias: "controlId", required: false }] }], controlName: [{ type: i0.Input, args: [{ isSignal: true, alias: "controlName", required: false }] }], error: [{ type: i0.Input, args: [{ isSignal: true, alias: "error", required: false }] }], autoError: [{ type: i0.Input, args: [{ isSignal: true, alias: "autoError", required: false }] }], hint: [{ type: i0.Input, args: [{ isSignal: true, alias: "hint", required: false }] }], id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], name: [{ type: i0.Input, args: [{ isSignal: true, alias: "name", required: false }] }], type: [{ type: i0.Input, args: [{ isSignal: true, alias: "type", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], maxlength: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxlength", required: false }] }], minlength: [{ type: i0.Input, args: [{ isSignal: true, alias: "minlength", required: false }] }], max: [{ type: i0.Input, args: [{ isSignal: true, alias: "max", required: false }] }], min: [{ type: i0.Input, args: [{ isSignal: true, alias: "min", required: false }] }], pattern: [{ type: i0.Input, args: [{ isSignal: true, alias: "pattern", required: false }] }], autocomplete: [{ type: i0.Input, args: [{ isSignal: true, alias: "autocomplete", required: false }] }], autofocus: [{ type: i0.Input, args: [{ isSignal: true, alias: "autofocus", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }], userClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], labelClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "labelClass", required: false }] }], inputClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "inputClass", required: false }] }], errorClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "errorClass", required: false }] }], hintClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "hintClass", required: false }] }] } });
|
|
217
245
|
|
|
218
246
|
/*
|
|
219
247
|
* Public API Surface of form-text-input
|
|
@@ -4,12 +4,20 @@ import { ClassValue } from 'clsx';
|
|
|
4
4
|
|
|
5
5
|
declare class EgFormTextInput {
|
|
6
6
|
private readonly formGroupDirective;
|
|
7
|
+
private readonly _errorMessages;
|
|
7
8
|
private readonly generatedId;
|
|
8
9
|
private readonly _config;
|
|
10
|
+
private readonly _shared;
|
|
9
11
|
label: _angular_core.InputSignal<string | undefined>;
|
|
10
12
|
controlId: _angular_core.InputSignal<string | undefined>;
|
|
11
13
|
controlName: _angular_core.InputSignal<string>;
|
|
12
14
|
error: _angular_core.InputSignal<string | undefined>;
|
|
15
|
+
/**
|
|
16
|
+
* Auto-resolve the displayed message from the control's `ValidationErrors`
|
|
17
|
+
* when `error()` is unset. Explicit `error()` always wins. Set to `false`
|
|
18
|
+
* for manual-only messages.
|
|
19
|
+
*/
|
|
20
|
+
autoError: _angular_core.InputSignal<boolean>;
|
|
13
21
|
hint: _angular_core.InputSignal<string | undefined>;
|
|
14
22
|
id: _angular_core.InputSignal<string | undefined>;
|
|
15
23
|
name: _angular_core.InputSignal<string | undefined>;
|
|
@@ -28,6 +36,19 @@ declare class EgFormTextInput {
|
|
|
28
36
|
readonly effectiveId: _angular_core.Signal<string>;
|
|
29
37
|
readonly errorId: _angular_core.Signal<string>;
|
|
30
38
|
readonly hintId: _angular_core.Signal<string>;
|
|
39
|
+
/**
|
|
40
|
+
* Displayed message: explicit `error()` wins; otherwise (when `autoError()`)
|
|
41
|
+
* auto-resolved from the control's `ValidationErrors`. Plain method (not a
|
|
42
|
+
* computed): `ValidationErrors` is not a signal, so the control must be read
|
|
43
|
+
* fresh on every change-detection pass.
|
|
44
|
+
*/
|
|
45
|
+
protected resolvedError(): string | undefined;
|
|
46
|
+
/**
|
|
47
|
+
* Whether the error is surfaced: message present + control invalid +
|
|
48
|
+
* touched/dirty/submitted. Gates the visual `<hlm-error>` (and
|
|
49
|
+
* `describedBy()`, where present) so sighted and screen-reader output agree.
|
|
50
|
+
*/
|
|
51
|
+
protected showError(): boolean;
|
|
31
52
|
describedBy(): string | null;
|
|
32
53
|
effectiveDisabled(): boolean;
|
|
33
54
|
userClass: _angular_core.InputSignal<ClassValue>;
|
|
@@ -41,7 +62,7 @@ declare class EgFormTextInput {
|
|
|
41
62
|
$errorClass: _angular_core.Signal<string>;
|
|
42
63
|
$hintClass: _angular_core.Signal<string>;
|
|
43
64
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<EgFormTextInput, never>;
|
|
44
|
-
static ɵcmp: _angular_core.ɵɵComponentDeclaration<EgFormTextInput, "eg-form-text-input", never, { "label": { "alias": "label"; "required": false; "isSignal": true; }; "controlId": { "alias": "controlId"; "required": false; "isSignal": true; }; "controlName": { "alias": "controlName"; "required": false; "isSignal": true; }; "error": { "alias": "error"; "required": false; "isSignal": true; }; "hint": { "alias": "hint"; "required": false; "isSignal": true; }; "id": { "alias": "id"; "required": false; "isSignal": true; }; "name": { "alias": "name"; "required": false; "isSignal": true; }; "type": { "alias": "type"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "readonly": { "alias": "readonly"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "maxlength": { "alias": "maxlength"; "required": false; "isSignal": true; }; "minlength": { "alias": "minlength"; "required": false; "isSignal": true; }; "max": { "alias": "max"; "required": false; "isSignal": true; }; "min": { "alias": "min"; "required": false; "isSignal": true; }; "pattern": { "alias": "pattern"; "required": false; "isSignal": true; }; "autocomplete": { "alias": "autocomplete"; "required": false; "isSignal": true; }; "autofocus": { "alias": "autofocus"; "required": false; "isSignal": true; }; "required": { "alias": "required"; "required": false; "isSignal": true; }; "userClass": { "alias": "class"; "required": false; "isSignal": true; }; "labelClass": { "alias": "labelClass"; "required": false; "isSignal": true; }; "inputClass": { "alias": "inputClass"; "required": false; "isSignal": true; }; "errorClass": { "alias": "errorClass"; "required": false; "isSignal": true; }; "hintClass": { "alias": "hintClass"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
65
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<EgFormTextInput, "eg-form-text-input", never, { "label": { "alias": "label"; "required": false; "isSignal": true; }; "controlId": { "alias": "controlId"; "required": false; "isSignal": true; }; "controlName": { "alias": "controlName"; "required": false; "isSignal": true; }; "error": { "alias": "error"; "required": false; "isSignal": true; }; "autoError": { "alias": "autoError"; "required": false; "isSignal": true; }; "hint": { "alias": "hint"; "required": false; "isSignal": true; }; "id": { "alias": "id"; "required": false; "isSignal": true; }; "name": { "alias": "name"; "required": false; "isSignal": true; }; "type": { "alias": "type"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "readonly": { "alias": "readonly"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "maxlength": { "alias": "maxlength"; "required": false; "isSignal": true; }; "minlength": { "alias": "minlength"; "required": false; "isSignal": true; }; "max": { "alias": "max"; "required": false; "isSignal": true; }; "min": { "alias": "min"; "required": false; "isSignal": true; }; "pattern": { "alias": "pattern"; "required": false; "isSignal": true; }; "autocomplete": { "alias": "autocomplete"; "required": false; "isSignal": true; }; "autofocus": { "alias": "autofocus"; "required": false; "isSignal": true; }; "required": { "alias": "required"; "required": false; "isSignal": true; }; "userClass": { "alias": "class"; "required": false; "isSignal": true; }; "labelClass": { "alias": "labelClass"; "required": false; "isSignal": true; }; "inputClass": { "alias": "inputClass"; "required": false; "isSignal": true; }; "errorClass": { "alias": "errorClass"; "required": false; "isSignal": true; }; "hintClass": { "alias": "hintClass"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
45
66
|
}
|
|
46
67
|
|
|
47
68
|
interface EgFormTextInputConfig {
|
package/form-textarea/README.md
CHANGED
|
@@ -75,28 +75,29 @@ Real selectors: `eg-form-textarea`, `hlm-form-field`, `label[hlmLabel]`, `textar
|
|
|
75
75
|
|
|
76
76
|
### `eg-form-textarea` — `EgFormTextarea`
|
|
77
77
|
|
|
78
|
-
| Input | Type | Default | Description
|
|
79
|
-
| --------------------- | ------------------------------- | ----------- |
|
|
80
|
-
| `label` | `string \| undefined` | `undefined` | Field label rendered as `<label hlmLabel>` bound to the textarea id.
|
|
81
|
-
| `controlName` | `string` | `''` | **Required.** Control name in the parent `FormGroup`; forwarded as `formControlName` and `name`.
|
|
82
|
-
| `controlId` | `string \| undefined` | `undefined` | Explicit id; falls back to `id`, then generated `eg-form-textarea-…`.
|
|
83
|
-
| `id` | `string \| undefined` | `undefined` | Alias for an explicit id (same fallback chain).
|
|
84
|
-
| `error` | `string \| undefined` | `undefined` | Error text rendered in `<hlm-error>`.
|
|
85
|
-
| `
|
|
86
|
-
| `
|
|
87
|
-
| `
|
|
88
|
-
| `
|
|
89
|
-
| `
|
|
90
|
-
| `
|
|
91
|
-
| `
|
|
92
|
-
| `
|
|
93
|
-
| `
|
|
94
|
-
| `
|
|
95
|
-
| `
|
|
96
|
-
| `
|
|
97
|
-
| `
|
|
98
|
-
| `
|
|
99
|
-
| `
|
|
78
|
+
| Input | Type | Default | Description |
|
|
79
|
+
| --------------------- | ------------------------------- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
80
|
+
| `label` | `string \| undefined` | `undefined` | Field label rendered as `<label hlmLabel>` bound to the textarea id. |
|
|
81
|
+
| `controlName` | `string` | `''` | **Required.** Control name in the parent `FormGroup`; forwarded as `formControlName` and `name`. |
|
|
82
|
+
| `controlId` | `string \| undefined` | `undefined` | Explicit id; falls back to `id`, then generated `eg-form-textarea-…`. |
|
|
83
|
+
| `id` | `string \| undefined` | `undefined` | Alias for an explicit id (same fallback chain). |
|
|
84
|
+
| `error` | `string \| undefined` | `undefined` | Error text rendered in `<hlm-error>`. |
|
|
85
|
+
| `autoError` | `boolean` | `true` | Auto-resolve the message from the control's `ValidationErrors` when `error` is unset. Explicit `error` always wins; `error=""` counts as unset. Global wording via `provideEgFormErrorMessages`. |
|
|
86
|
+
| `hint` | `string \| undefined` | `undefined` | Hint text rendered in `<hlm-hint>`. |
|
|
87
|
+
| `name` | `string \| undefined` | `undefined` | `name` attribute fallback when `controlName` is empty. |
|
|
88
|
+
| `placeholder` | `string` | `''` | Placeholder text. |
|
|
89
|
+
| `readonly` | `boolean` | `false` | Native `readonly` attribute. |
|
|
90
|
+
| `disabled` | `boolean` | `false` | Wrapper-level disable (OR-ed with the reactive disabled state — see `effectiveDisabled()`). |
|
|
91
|
+
| `maxlength` | `string \| number \| null` | `null` | Native `maxlength`. |
|
|
92
|
+
| `minlength` | `string \| number \| null` | `null` | Native `minlength`. |
|
|
93
|
+
| `required` | `boolean` | `false` | Native `required` + red `*` on the label. |
|
|
94
|
+
| `rows` | `string \| number \| undefined` | `3` | Native `rows` (visible height). |
|
|
95
|
+
| `cols` | `string \| number \| undefined` | `undefined` | Native `cols` (visible width). |
|
|
96
|
+
| `class` (`userClass`) | `ClassValue` | `''` | Extra host classes (merged over `tw:w-full`). |
|
|
97
|
+
| `labelClass` | `string` | `''` | Extra label classes (merged over `tw:mb-1 tw:gap-0`). |
|
|
98
|
+
| `textareaClass` | `string` | `''` | Extra textarea classes (merged over `tw:mb-1`). |
|
|
99
|
+
| `errorClass` | `string` | `''` | Extra error classes (merged over `tw:mt-0`). |
|
|
100
|
+
| `hintClass` | `string` | `''` | Extra hint classes (merged over `tw:mt-0`). |
|
|
100
101
|
|
|
101
102
|
No outputs. Methods: `describedBy(): string | null` (error id when invalid + dirty/touched, else hint id, else `null`); `effectiveDisabled(): boolean` (`disabled()` OR the control's reactive disabled state). Readonly computeds: `effectiveId()`, `errorId()`, `hintId()`.
|
|
102
103
|
|