@egose/shadcn-theme-ng-tw 0.0.28 → 0.1.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 +130 -13
- package/accordion/README.md +2 -63
- package/accordion/fesm2022/accordion.mjs +20 -20
- package/alert/README.md +2 -63
- package/alert/fesm2022/alert.mjs +18 -18
- package/alert-dialog/fesm2022/alert-dialog.mjs +48 -48
- package/alert-dialog/types/alert-dialog.d.ts +1 -1
- package/aspect-ratio/fesm2022/aspect-ratio.mjs +9 -9
- package/autocomplete/README.md +2 -63
- package/autocomplete/fesm2022/autocomplete.mjs +54 -54
- package/autocomplete/types/autocomplete.d.ts +1 -1
- package/avatar/fesm2022/avatar.mjs +32 -32
- package/badge/README.md +2 -63
- package/badge/fesm2022/badge.mjs +4 -4
- package/basic-alert/README.md +2 -63
- package/basic-alert/fesm2022/basic-alert.mjs +4 -4
- package/basic-alert/types/basic-alert.d.ts +1 -1
- package/breadcrumb/fesm2022/breadcrumb.mjs +34 -34
- package/button/README.md +2 -63
- package/button/fesm2022/button.mjs +11 -11
- package/button/types/button.d.ts +2 -2
- package/button-group/fesm2022/button-group.mjs +20 -20
- package/calendar/README.md +2 -63
- package/calendar/fesm2022/calendar.mjs +154 -154
- package/card/fesm2022/card.mjs +33 -33
- package/carousel/fesm2022/carousel.mjs +44 -44
- package/carousel/types/carousel.d.ts +1 -1
- package/checkbox/README.md +2 -63
- package/checkbox/fesm2022/checkbox.mjs +22 -20
- package/checkbox/types/checkbox.d.ts +5 -4
- package/collapsible/fesm2022/collapsible.mjs +15 -15
- package/combobox/fesm2022/combobox.mjs +92 -92
- package/combobox/types/combobox.d.ts +1 -1
- package/command/fesm2022/command.mjs +56 -56
- package/confirmation-dialog/README.md +2 -63
- package/confirmation-dialog/fesm2022/confirmation-dialog.mjs +13 -12
- package/confirmation-dialog/types/confirmation-dialog.d.ts +9 -5
- package/context-menu/fesm2022/context-menu.mjs +9 -9
- package/date-picker/README.md +2 -63
- package/date-picker/fesm2022/date-picker.mjs +79 -68
- package/date-picker/types/date-picker.d.ts +8 -4
- package/dialog/README.md +2 -63
- package/dialog/fesm2022/dialog.mjs +48 -48
- package/drawer/fesm2022/drawer.mjs +45 -45
- package/dropdown-menu/fesm2022/dropdown-menu.mjs +85 -73
- package/dropdown-menu/types/dropdown-menu.d.ts +4 -0
- package/empty/fesm2022/empty.mjs +31 -31
- package/field/fesm2022/field.mjs +59 -59
- package/field/types/field.d.ts +1 -1
- package/form-checkbox/README.md +2 -63
- package/form-checkbox/fesm2022/form-checkbox.mjs +37 -19
- package/form-checkbox/types/form-checkbox.d.ts +7 -1
- package/form-date-picker/README.md +2 -63
- package/form-date-picker/fesm2022/form-date-picker.mjs +59 -24
- package/form-date-picker/types/form-date-picker.d.ts +7 -1
- package/form-field/README.md +2 -63
- package/form-field/fesm2022/form-field.mjs +30 -16
- package/form-field/types/form-field.d.ts +28 -20
- package/form-field-simple/README.md +2 -63
- package/form-field-simple/fesm2022/form-field-simple.mjs +4 -4
- package/form-searchable-multiselect/README.md +2 -63
- package/form-searchable-multiselect/fesm2022/form-searchable-multiselect.mjs +41 -21
- package/form-searchable-multiselect/types/form-searchable-multiselect.d.ts +8 -2
- package/form-select/README.md +2 -63
- package/form-select/fesm2022/form-select.mjs +62 -29
- package/form-select/types/form-select.d.ts +7 -1
- package/form-text-input/README.md +2 -63
- package/form-text-input/fesm2022/form-text-input.mjs +43 -55
- package/form-text-input/types/form-text-input.d.ts +9 -12
- package/form-textarea/README.md +2 -63
- package/form-textarea/fesm2022/form-textarea.mjs +42 -23
- package/form-textarea/types/form-textarea.d.ts +8 -1
- package/hover-card/fesm2022/hover-card.mjs +19 -19
- package/icon/README.md +2 -63
- package/icon/fesm2022/icon.mjs +8 -8
- package/input/README.md +2 -63
- package/input/fesm2022/input.mjs +17 -12
- package/input/types/input.d.ts +2 -1
- package/input-group/fesm2022/input-group.mjs +37 -37
- package/input-group/types/input-group.d.ts +3 -3
- package/input-otp/fesm2022/input-otp.mjs +27 -27
- package/item/fesm2022/item.mjs +54 -54
- package/kbd/fesm2022/kbd.mjs +13 -13
- package/label/README.md +2 -63
- package/label/fesm2022/label.mjs +9 -9
- package/label/types/label.d.ts +1 -1
- package/layout-simple/README.md +2 -63
- package/layout-simple/fesm2022/layout-simple.mjs +88 -37
- package/layout-simple/types/layout-simple.d.ts +26 -12
- package/menu/README.md +3 -0
- package/menu/fesm2022/menu.mjs +461 -0
- package/menu/package.json +24 -0
- package/menu/types/menu.d.ts +137 -0
- package/menubar/fesm2022/menubar.mjs +13 -13
- package/native-select/fesm2022/native-select.mjs +19 -19
- package/navigation-menu/fesm2022/navigation-menu.mjs +37 -37
- package/package.json +183 -154
- package/pagination/fesm2022/pagination.mjs +63 -63
- package/popover/README.md +2 -63
- package/popover/fesm2022/popover.mjs +30 -30
- package/progress/fesm2022/progress.mjs +13 -13
- package/radio-group/README.md +2 -63
- package/radio-group/fesm2022/radio-group.mjs +22 -19
- package/resizable/fesm2022/resizable.mjs +19 -19
- package/scroll-area/fesm2022/scroll-area.mjs +9 -9
- package/searchable-multiselect/README.md +2 -63
- package/searchable-multiselect/fesm2022/searchable-multiselect.mjs +63 -16
- package/searchable-multiselect/types/searchable-multiselect.d.ts +8 -2
- package/select/README.md +2 -63
- package/select/fesm2022/select.mjs +80 -72
- package/select/types/select.d.ts +3 -1
- package/separator/README.md +2 -63
- package/separator/fesm2022/separator.mjs +9 -9
- package/separator/types/separator.d.ts +1 -1
- package/sheet/README.md +2 -63
- package/sheet/fesm2022/sheet.mjs +30 -30
- package/sidebar/fesm2022/sidebar.mjs +136 -134
- package/sidebar/types/sidebar.d.ts +3 -3
- package/skeleton/fesm2022/skeleton.mjs +9 -9
- package/slider/fesm2022/slider.mjs +25 -25
- package/sonner/README.md +2 -63
- package/sonner/fesm2022/sonner.mjs +9 -9
- package/spinner/README.md +2 -63
- package/spinner/fesm2022/spinner.mjs +8 -8
- package/switch/README.md +2 -63
- package/switch/fesm2022/switch.mjs +12 -14
- package/table/fesm2022/table.mjs +41 -41
- package/tabs/README.md +2 -63
- package/tabs/fesm2022/tabs.mjs +38 -38
- package/textarea/fesm2022/textarea.mjs +9 -9
- package/toggle/fesm2022/toggle.mjs +14 -14
- package/toggle-group/fesm2022/toggle-group.mjs +13 -13
- package/toggle-group/types/toggle-group.d.ts +13 -7
- package/tooltip/README.md +2 -63
- package/tooltip/fesm2022/tooltip.mjs +14 -14
- package/typography/fesm2022/typography.mjs +53 -53
- package/typography/types/typography.d.ts +12 -12
- package/utils/README.md +2 -63
- package/utils/fesm2022/utils.mjs +68 -44
- package/accordion/fesm2022/accordion.mjs.map +0 -1
- package/alert/fesm2022/alert.mjs.map +0 -1
- package/alert-dialog/fesm2022/alert-dialog.mjs.map +0 -1
- package/aspect-ratio/fesm2022/aspect-ratio.mjs.map +0 -1
- package/autocomplete/fesm2022/autocomplete.mjs.map +0 -1
- package/avatar/fesm2022/avatar.mjs.map +0 -1
- package/badge/fesm2022/badge.mjs.map +0 -1
- package/basic-alert/fesm2022/basic-alert.mjs.map +0 -1
- package/breadcrumb/fesm2022/breadcrumb.mjs.map +0 -1
- package/button/fesm2022/button.mjs.map +0 -1
- package/button-group/fesm2022/button-group.mjs.map +0 -1
- package/calendar/fesm2022/calendar.mjs.map +0 -1
- package/card/fesm2022/card.mjs.map +0 -1
- package/carousel/fesm2022/carousel.mjs.map +0 -1
- package/checkbox/fesm2022/checkbox.mjs.map +0 -1
- package/collapsible/fesm2022/collapsible.mjs.map +0 -1
- package/combobox/fesm2022/combobox.mjs.map +0 -1
- package/command/fesm2022/command.mjs.map +0 -1
- package/confirmation-dialog/fesm2022/confirmation-dialog.mjs.map +0 -1
- package/context-menu/fesm2022/context-menu.mjs.map +0 -1
- package/date-picker/fesm2022/date-picker.mjs.map +0 -1
- package/dialog/fesm2022/dialog.mjs.map +0 -1
- package/drawer/fesm2022/drawer.mjs.map +0 -1
- package/dropdown-menu/fesm2022/dropdown-menu.mjs.map +0 -1
- package/empty/fesm2022/empty.mjs.map +0 -1
- package/field/fesm2022/field.mjs.map +0 -1
- package/form-checkbox/fesm2022/form-checkbox.mjs.map +0 -1
- package/form-date-picker/fesm2022/form-date-picker.mjs.map +0 -1
- package/form-field/fesm2022/form-field.mjs.map +0 -1
- package/form-field-simple/fesm2022/form-field-simple.mjs.map +0 -1
- package/form-searchable-multiselect/fesm2022/form-searchable-multiselect.mjs.map +0 -1
- package/form-select/fesm2022/form-select.mjs.map +0 -1
- package/form-text-input/fesm2022/form-text-input.mjs.map +0 -1
- package/form-textarea/fesm2022/form-textarea.mjs.map +0 -1
- package/hover-card/fesm2022/hover-card.mjs.map +0 -1
- package/icon/fesm2022/icon.mjs.map +0 -1
- package/input/fesm2022/input.mjs.map +0 -1
- package/input-group/fesm2022/input-group.mjs.map +0 -1
- package/input-otp/fesm2022/input-otp.mjs.map +0 -1
- package/item/fesm2022/item.mjs.map +0 -1
- package/kbd/fesm2022/kbd.mjs.map +0 -1
- package/label/fesm2022/label.mjs.map +0 -1
- package/layout-simple/fesm2022/layout-simple.mjs.map +0 -1
- package/menubar/fesm2022/menubar.mjs.map +0 -1
- package/native-select/fesm2022/native-select.mjs.map +0 -1
- package/navigation-menu/fesm2022/navigation-menu.mjs.map +0 -1
- package/pagination/fesm2022/pagination.mjs.map +0 -1
- package/popover/fesm2022/popover.mjs.map +0 -1
- package/progress/fesm2022/progress.mjs.map +0 -1
- package/radio-group/fesm2022/radio-group.mjs.map +0 -1
- package/resizable/fesm2022/resizable.mjs.map +0 -1
- package/scroll-area/fesm2022/scroll-area.mjs.map +0 -1
- package/searchable-multiselect/fesm2022/searchable-multiselect.mjs.map +0 -1
- package/select/fesm2022/select.mjs.map +0 -1
- package/separator/fesm2022/separator.mjs.map +0 -1
- package/sheet/fesm2022/sheet.mjs.map +0 -1
- package/sidebar/fesm2022/sidebar.mjs.map +0 -1
- package/skeleton/fesm2022/skeleton.mjs.map +0 -1
- package/slider/fesm2022/slider.mjs.map +0 -1
- package/sonner/fesm2022/sonner.mjs.map +0 -1
- package/spinner/fesm2022/spinner.mjs.map +0 -1
- package/switch/fesm2022/switch.mjs.map +0 -1
- package/table/fesm2022/table.mjs.map +0 -1
- package/tabs/fesm2022/tabs.mjs.map +0 -1
- package/textarea/fesm2022/textarea.mjs.map +0 -1
- package/toggle/fesm2022/toggle.mjs.map +0 -1
- package/toggle-group/fesm2022/toggle-group.mjs.map +0 -1
- package/tooltip/fesm2022/tooltip.mjs.map +0 -1
- package/typography/fesm2022/typography.mjs.map +0 -1
- package/utils/fesm2022/utils.mjs.map +0 -1
|
@@ -1,45 +1,15 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import {
|
|
2
|
+
import { inject, input, computed, Component } from '@angular/core';
|
|
3
3
|
import * as i1 from '@angular/forms';
|
|
4
|
-
import {
|
|
5
|
-
import { HlmFormField, HlmError, HlmHint } from '@egose/shadcn-theme-ng-tw/form-field';
|
|
4
|
+
import { FormGroupDirective, ReactiveFormsModule, ControlContainer } from '@angular/forms';
|
|
5
|
+
import { HlmFormIdGenerator, 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';
|
|
9
9
|
|
|
10
|
-
// NOT USED
|
|
11
|
-
class SpreadAttrsDirective {
|
|
12
|
-
el;
|
|
13
|
-
renderer;
|
|
14
|
-
attrs = input({}, /* @ts-ignore */
|
|
15
|
-
...(ngDevMode ? [{ debugName: "attrs" }] : /* istanbul ignore next */ []));
|
|
16
|
-
constructor(el, renderer) {
|
|
17
|
-
this.el = el;
|
|
18
|
-
this.renderer = renderer;
|
|
19
|
-
}
|
|
20
|
-
ngOnChanges() {
|
|
21
|
-
const obj = this.attrs();
|
|
22
|
-
for (const [key, value] of Object.entries(obj)) {
|
|
23
|
-
if (value === null || value === undefined || value === false) {
|
|
24
|
-
this.renderer.removeAttribute(this.el.nativeElement, key);
|
|
25
|
-
}
|
|
26
|
-
else {
|
|
27
|
-
this.renderer.setAttribute(this.el.nativeElement, key, String(value));
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.7", ngImport: i0, type: SpreadAttrsDirective, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Directive });
|
|
32
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.7", type: SpreadAttrsDirective, isStandalone: true, selector: "[spreadAttrs]", inputs: { attrs: { classPropertyName: "attrs", publicName: "attrs", isSignal: true, isRequired: false, transformFunction: null } }, usesOnChanges: true, ngImport: i0 });
|
|
33
|
-
}
|
|
34
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.7", ngImport: i0, type: SpreadAttrsDirective, decorators: [{
|
|
35
|
-
type: Directive,
|
|
36
|
-
args: [{
|
|
37
|
-
selector: '[spreadAttrs]',
|
|
38
|
-
standalone: true,
|
|
39
|
-
}]
|
|
40
|
-
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.Renderer2 }], propDecorators: { attrs: [{ type: i0.Input, args: [{ isSignal: true, alias: "attrs", required: false }] }] } });
|
|
41
|
-
let nextId = 0;
|
|
42
10
|
class EgFormTextInput {
|
|
11
|
+
formGroupDirective = inject(FormGroupDirective);
|
|
12
|
+
generatedId = inject(HlmFormIdGenerator).generate('eg-form-text-input');
|
|
43
13
|
label = input(undefined, /* @ts-ignore */
|
|
44
14
|
...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
45
15
|
controlId = input(undefined, /* @ts-ignore */
|
|
@@ -51,9 +21,8 @@ class EgFormTextInput {
|
|
|
51
21
|
hint = input(undefined, /* @ts-ignore */
|
|
52
22
|
...(ngDevMode ? [{ debugName: "hint" }] : /* istanbul ignore next */ []));
|
|
53
23
|
// HTML/input attributes
|
|
54
|
-
id = input(
|
|
24
|
+
id = input(undefined, /* @ts-ignore */
|
|
55
25
|
...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
|
|
56
|
-
// id = input<string>(`eg-form-text-input-${nextId++}`);
|
|
57
26
|
name = input(undefined, /* @ts-ignore */
|
|
58
27
|
...(ngDevMode ? [{ debugName: "name" }] : /* istanbul ignore next */ []));
|
|
59
28
|
type = input('text', /* @ts-ignore */
|
|
@@ -80,6 +49,23 @@ class EgFormTextInput {
|
|
|
80
49
|
...(ngDevMode ? [{ debugName: "autofocus" }] : /* istanbul ignore next */ []));
|
|
81
50
|
required = input(false, /* @ts-ignore */
|
|
82
51
|
...(ngDevMode ? [{ debugName: "required" }] : /* istanbul ignore next */ []));
|
|
52
|
+
effectiveId = computed(() => this.controlId() || this.id() || this.generatedId, /* @ts-ignore */
|
|
53
|
+
...(ngDevMode ? [{ debugName: "effectiveId" }] : /* istanbul ignore next */ []));
|
|
54
|
+
errorId = computed(() => `${this.effectiveId()}-error`, /* @ts-ignore */
|
|
55
|
+
...(ngDevMode ? [{ debugName: "errorId" }] : /* istanbul ignore next */ []));
|
|
56
|
+
hintId = computed(() => `${this.effectiveId()}-hint`, /* @ts-ignore */
|
|
57
|
+
...(ngDevMode ? [{ debugName: "hintId" }] : /* istanbul ignore next */ []));
|
|
58
|
+
describedBy() {
|
|
59
|
+
const control = this.formGroupDirective.form.get(this.controlName());
|
|
60
|
+
return this.error() && control?.invalid && (control.dirty || control.touched)
|
|
61
|
+
? this.errorId()
|
|
62
|
+
: this.hint()
|
|
63
|
+
? this.hintId()
|
|
64
|
+
: null;
|
|
65
|
+
}
|
|
66
|
+
effectiveDisabled() {
|
|
67
|
+
return this.disabled() || !!this.formGroupDirective.form.get(this.controlName())?.disabled;
|
|
68
|
+
}
|
|
83
69
|
// Styling classes
|
|
84
70
|
userClass = input('', { ...(ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {}), alias: 'class' });
|
|
85
71
|
labelClass = input('', /* @ts-ignore */
|
|
@@ -101,10 +87,9 @@ class EgFormTextInput {
|
|
|
101
87
|
...(ngDevMode ? [{ debugName: "$errorClass" }] : /* istanbul ignore next */ []));
|
|
102
88
|
$hintClass = computed(() => hlm('tw:mt-0', this.hintClass()), /* @ts-ignore */
|
|
103
89
|
...(ngDevMode ? [{ debugName: "$hintClass" }] : /* istanbul ignore next */ []));
|
|
104
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.
|
|
105
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.
|
|
90
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: EgFormTextInput, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
91
|
+
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: { classAttribute: "tw:w-full" }, providers: [{ provide: ControlContainer, useExisting: FormGroupDirective }], ngImport: i0, template: `
|
|
106
92
|
@let lbl = label();
|
|
107
|
-
@let cid = controlId();
|
|
108
93
|
@let cnm = controlName();
|
|
109
94
|
@let err = error();
|
|
110
95
|
@let hnt = hint();
|
|
@@ -112,24 +97,26 @@ class EgFormTextInput {
|
|
|
112
97
|
|
|
113
98
|
<hlm-form-field>
|
|
114
99
|
@if (lbl) {
|
|
115
|
-
<
|
|
100
|
+
<label hlmLabel [for]="effectiveId()" [class]="$labelClass()"
|
|
116
101
|
>{{ lbl }}
|
|
117
102
|
@if (rqrd) {
|
|
118
103
|
<span class="tw:text-red-500">*</span>
|
|
119
104
|
}
|
|
120
|
-
</
|
|
105
|
+
</label>
|
|
121
106
|
}
|
|
122
107
|
|
|
123
108
|
<input
|
|
124
109
|
hlmInput
|
|
125
110
|
[attr.aria-label]="lbl"
|
|
126
|
-
[id]="
|
|
111
|
+
[id]="effectiveId()"
|
|
127
112
|
[name]="cnm || name()"
|
|
128
113
|
[formControlName]="cnm"
|
|
129
114
|
[class]="$inputClass()"
|
|
130
115
|
[type]="type()"
|
|
131
116
|
[placeholder]="placeholder()"
|
|
132
117
|
[readonly]="readonly()"
|
|
118
|
+
[attr.disabled]="effectiveDisabled() ? '' : null"
|
|
119
|
+
[ariaDescribedby]="describedBy()"
|
|
133
120
|
[max]="max()"
|
|
134
121
|
[min]="min()"
|
|
135
122
|
[maxlength]="maxlength()"
|
|
@@ -141,20 +128,20 @@ class EgFormTextInput {
|
|
|
141
128
|
/>
|
|
142
129
|
|
|
143
130
|
@if (err) {
|
|
144
|
-
<hlm-error [class]="$errorClass()">
|
|
131
|
+
<hlm-error [id]="errorId()" [class]="$errorClass()">
|
|
145
132
|
{{ err }}
|
|
146
133
|
</hlm-error>
|
|
147
134
|
}
|
|
148
135
|
|
|
149
136
|
@if (hnt) {
|
|
150
|
-
<hlm-hint [class]="$hintClass()">
|
|
137
|
+
<hlm-hint [id]="hintId()" [class]="$hintClass()">
|
|
151
138
|
{{ hnt }}
|
|
152
139
|
</hlm-hint>
|
|
153
140
|
}
|
|
154
141
|
</hlm-form-field>
|
|
155
|
-
`, isInline: true, dependencies: [{ kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox]):not([ngNoCva])[formControlName],textarea:not([ngNoCva])[formControlName],input:not([type=checkbox]):not([ngNoCva])[formControl],textarea:not([ngNoCva])[formControl],input:not([type=checkbox]):not([ngNoCva])[ngModel],textarea:not([ngNoCva])[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i1.MinLengthValidator, selector: "[minlength][formControlName],[minlength][formControl],[minlength][ngModel]", inputs: ["minlength"] }, { kind: "directive", type: i1.MaxLengthValidator, selector: "[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]", inputs: ["maxlength"] }, { kind: "directive", type: i1.PatternValidator, selector: "[pattern][formControlName],[pattern][formControl],[pattern][ngModel]", inputs: ["pattern"] }, { kind: "directive", type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: HlmFormField, selector: "hlm-form-field", inputs: ["class"] }, { kind: "directive", type: HlmError, selector: "hlm-error", inputs: ["class"] }, { kind: "directive", type: HlmHint, selector: "hlm-hint", inputs: ["class"] }, { kind: "directive", type: HlmLabel, selector: "[hlmLabel]", inputs: ["class"] }, { kind: "directive", type: HlmInput, selector: "[hlmInput]" }] });
|
|
142
|
+
`, isInline: true, dependencies: [{ kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox]):not([ngNoCva])[formControlName],textarea:not([ngNoCva])[formControlName],input:not([type=checkbox]):not([ngNoCva])[formControl],textarea:not([ngNoCva])[formControl],input:not([type=checkbox]):not([ngNoCva])[ngModel],textarea:not([ngNoCva])[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i1.MinLengthValidator, selector: "[minlength][formControlName],[minlength][formControl],[minlength][ngModel]", inputs: ["minlength"] }, { kind: "directive", type: i1.MaxLengthValidator, selector: "[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]", inputs: ["maxlength"] }, { kind: "directive", type: i1.PatternValidator, selector: "[pattern][formControlName],[pattern][formControl],[pattern][ngModel]", inputs: ["pattern"] }, { kind: "directive", type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: HlmFormField, selector: "hlm-form-field", inputs: ["class"] }, { kind: "directive", type: HlmError, selector: "hlm-error", inputs: ["class"] }, { kind: "directive", type: HlmHint, selector: "hlm-hint", inputs: ["class"] }, { kind: "directive", type: HlmLabel, selector: "[hlmLabel]", inputs: ["class"] }, { kind: "directive", type: HlmInput, selector: "[hlmInput]", inputs: ["ariaDescribedby"] }] });
|
|
156
143
|
}
|
|
157
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.
|
|
144
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: EgFormTextInput, decorators: [{
|
|
158
145
|
type: Component,
|
|
159
146
|
args: [{
|
|
160
147
|
selector: 'eg-form-text-input',
|
|
@@ -166,7 +153,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.7", ngImpor
|
|
|
166
153
|
providers: [{ provide: ControlContainer, useExisting: FormGroupDirective }],
|
|
167
154
|
template: `
|
|
168
155
|
@let lbl = label();
|
|
169
|
-
@let cid = controlId();
|
|
170
156
|
@let cnm = controlName();
|
|
171
157
|
@let err = error();
|
|
172
158
|
@let hnt = hint();
|
|
@@ -174,24 +160,26 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.7", ngImpor
|
|
|
174
160
|
|
|
175
161
|
<hlm-form-field>
|
|
176
162
|
@if (lbl) {
|
|
177
|
-
<
|
|
163
|
+
<label hlmLabel [for]="effectiveId()" [class]="$labelClass()"
|
|
178
164
|
>{{ lbl }}
|
|
179
165
|
@if (rqrd) {
|
|
180
166
|
<span class="tw:text-red-500">*</span>
|
|
181
167
|
}
|
|
182
|
-
</
|
|
168
|
+
</label>
|
|
183
169
|
}
|
|
184
170
|
|
|
185
171
|
<input
|
|
186
172
|
hlmInput
|
|
187
173
|
[attr.aria-label]="lbl"
|
|
188
|
-
[id]="
|
|
174
|
+
[id]="effectiveId()"
|
|
189
175
|
[name]="cnm || name()"
|
|
190
176
|
[formControlName]="cnm"
|
|
191
177
|
[class]="$inputClass()"
|
|
192
178
|
[type]="type()"
|
|
193
179
|
[placeholder]="placeholder()"
|
|
194
180
|
[readonly]="readonly()"
|
|
181
|
+
[attr.disabled]="effectiveDisabled() ? '' : null"
|
|
182
|
+
[ariaDescribedby]="describedBy()"
|
|
195
183
|
[max]="max()"
|
|
196
184
|
[min]="min()"
|
|
197
185
|
[maxlength]="maxlength()"
|
|
@@ -203,13 +191,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.7", ngImpor
|
|
|
203
191
|
/>
|
|
204
192
|
|
|
205
193
|
@if (err) {
|
|
206
|
-
<hlm-error [class]="$errorClass()">
|
|
194
|
+
<hlm-error [id]="errorId()" [class]="$errorClass()">
|
|
207
195
|
{{ err }}
|
|
208
196
|
</hlm-error>
|
|
209
197
|
}
|
|
210
198
|
|
|
211
199
|
@if (hnt) {
|
|
212
|
-
<hlm-hint [class]="$hintClass()">
|
|
200
|
+
<hlm-hint [id]="hintId()" [class]="$hintClass()">
|
|
213
201
|
{{ hnt }}
|
|
214
202
|
</hlm-hint>
|
|
215
203
|
}
|
|
@@ -226,5 +214,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.7", ngImpor
|
|
|
226
214
|
* Generated bundle index. Do not edit.
|
|
227
215
|
*/
|
|
228
216
|
|
|
229
|
-
export { EgFormTextInput
|
|
230
|
-
|
|
217
|
+
export { EgFormTextInput };
|
|
218
|
+
|
|
@@ -1,23 +1,15 @@
|
|
|
1
1
|
import * as _angular_core from '@angular/core';
|
|
2
|
-
import { OnChanges, ElementRef, Renderer2 } from '@angular/core';
|
|
3
2
|
import { ClassValue } from 'clsx';
|
|
4
3
|
|
|
5
|
-
declare class SpreadAttrsDirective implements OnChanges {
|
|
6
|
-
private el;
|
|
7
|
-
private renderer;
|
|
8
|
-
attrs: _angular_core.InputSignal<Record<string, any>>;
|
|
9
|
-
constructor(el: ElementRef, renderer: Renderer2);
|
|
10
|
-
ngOnChanges(): void;
|
|
11
|
-
static ɵfac: _angular_core.ɵɵFactoryDeclaration<SpreadAttrsDirective, never>;
|
|
12
|
-
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<SpreadAttrsDirective, "[spreadAttrs]", never, { "attrs": { "alias": "attrs"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
13
|
-
}
|
|
14
4
|
declare class EgFormTextInput {
|
|
5
|
+
private readonly formGroupDirective;
|
|
6
|
+
private readonly generatedId;
|
|
15
7
|
label: _angular_core.InputSignal<string | undefined>;
|
|
16
8
|
controlId: _angular_core.InputSignal<string | undefined>;
|
|
17
9
|
controlName: _angular_core.InputSignal<string>;
|
|
18
10
|
error: _angular_core.InputSignal<string | undefined>;
|
|
19
11
|
hint: _angular_core.InputSignal<string | undefined>;
|
|
20
|
-
id: _angular_core.InputSignal<string>;
|
|
12
|
+
id: _angular_core.InputSignal<string | undefined>;
|
|
21
13
|
name: _angular_core.InputSignal<string | undefined>;
|
|
22
14
|
type: _angular_core.InputSignal<string>;
|
|
23
15
|
placeholder: _angular_core.InputSignal<string>;
|
|
@@ -31,6 +23,11 @@ declare class EgFormTextInput {
|
|
|
31
23
|
autocomplete: _angular_core.InputSignal<string | undefined>;
|
|
32
24
|
autofocus: _angular_core.InputSignal<boolean>;
|
|
33
25
|
required: _angular_core.InputSignal<boolean>;
|
|
26
|
+
readonly effectiveId: _angular_core.Signal<string>;
|
|
27
|
+
readonly errorId: _angular_core.Signal<string>;
|
|
28
|
+
readonly hintId: _angular_core.Signal<string>;
|
|
29
|
+
describedBy(): string | null;
|
|
30
|
+
effectiveDisabled(): boolean;
|
|
34
31
|
userClass: _angular_core.InputSignal<ClassValue>;
|
|
35
32
|
labelClass: _angular_core.InputSignal<string>;
|
|
36
33
|
inputClass: _angular_core.InputSignal<string>;
|
|
@@ -45,4 +42,4 @@ declare class EgFormTextInput {
|
|
|
45
42
|
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>;
|
|
46
43
|
}
|
|
47
44
|
|
|
48
|
-
export { EgFormTextInput
|
|
45
|
+
export { EgFormTextInput };
|
package/form-textarea/README.md
CHANGED
|
@@ -1,64 +1,3 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Form Textarea Subpath
|
|
2
2
|
|
|
3
|
-
This project
|
|
4
|
-
|
|
5
|
-
## Code scaffolding
|
|
6
|
-
|
|
7
|
-
Angular CLI includes powerful code scaffolding tools. To generate a new component, run:
|
|
8
|
-
|
|
9
|
-
```bash
|
|
10
|
-
ng generate component component-name
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
For a complete list of available schematics (such as `components`, `directives`, or `pipes`), run:
|
|
14
|
-
|
|
15
|
-
```bash
|
|
16
|
-
ng generate --help
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
## Building
|
|
20
|
-
|
|
21
|
-
To build the library, run:
|
|
22
|
-
|
|
23
|
-
```bash
|
|
24
|
-
ng build form-textarea
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
This command will compile your project, and the build artifacts will be placed in the `dist/` directory.
|
|
28
|
-
|
|
29
|
-
### Publishing the Library
|
|
30
|
-
|
|
31
|
-
Once the project is built, you can publish your library by following these steps:
|
|
32
|
-
|
|
33
|
-
1. Navigate to the `dist` directory:
|
|
34
|
-
|
|
35
|
-
```bash
|
|
36
|
-
cd dist/form-textarea
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
2. Run the `npm publish` command to publish your library to the npm registry:
|
|
40
|
-
```bash
|
|
41
|
-
npm publish
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
## Running unit tests
|
|
45
|
-
|
|
46
|
-
To execute unit tests with the [Karma](https://karma-runner.github.io) test runner, use the following command:
|
|
47
|
-
|
|
48
|
-
```bash
|
|
49
|
-
ng test
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
## Running end-to-end tests
|
|
53
|
-
|
|
54
|
-
For end-to-end (e2e) testing, run:
|
|
55
|
-
|
|
56
|
-
```bash
|
|
57
|
-
ng e2e
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
Angular CLI does not come with an end-to-end testing framework by default. You can choose one that suits your needs.
|
|
61
|
-
|
|
62
|
-
## Additional Resources
|
|
63
|
-
|
|
64
|
-
For more information on using the Angular CLI, including detailed command references, visit the [Angular CLI Overview and Command Reference](https://angular.dev/tools/cli) page.
|
|
3
|
+
This project ships only as `@egose/shadcn-theme-ng/form-textarea` or `@egose/shadcn-theme-ng-tw/form-textarea`. See the [package README](../../README.md) for installation, compatibility, Tailwind variant, test, and release guidance. Do not publish this project directory independently.
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { input, computed, Component } from '@angular/core';
|
|
2
|
+
import { inject, input, computed, Component } from '@angular/core';
|
|
3
3
|
import * as i1 from '@angular/forms';
|
|
4
|
-
import {
|
|
5
|
-
import { HlmFormField, HlmError, HlmHint } from '@egose/shadcn-theme-ng-tw/form-field';
|
|
4
|
+
import { FormGroupDirective, ReactiveFormsModule, ControlContainer } from '@angular/forms';
|
|
5
|
+
import { HlmFormIdGenerator, 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';
|
|
9
9
|
|
|
10
|
-
let nextId = 0;
|
|
11
10
|
class EgFormTextarea {
|
|
11
|
+
formGroupDirective = inject(FormGroupDirective);
|
|
12
|
+
generatedId = inject(HlmFormIdGenerator).generate('eg-form-textarea');
|
|
12
13
|
// General props
|
|
13
14
|
label = input(undefined, /* @ts-ignore */
|
|
14
15
|
...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
@@ -21,9 +22,8 @@ class EgFormTextarea {
|
|
|
21
22
|
hint = input(undefined, /* @ts-ignore */
|
|
22
23
|
...(ngDevMode ? [{ debugName: "hint" }] : /* istanbul ignore next */ []));
|
|
23
24
|
// HTML/textarea attributes
|
|
24
|
-
id = input(
|
|
25
|
+
id = input(undefined, /* @ts-ignore */
|
|
25
26
|
...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
|
|
26
|
-
// id = input<string>(`eg-form-text-input-${nextId++}`);
|
|
27
27
|
name = input(undefined, /* @ts-ignore */
|
|
28
28
|
...(ngDevMode ? [{ debugName: "name" }] : /* istanbul ignore next */ []));
|
|
29
29
|
placeholder = input('', /* @ts-ignore */
|
|
@@ -42,6 +42,23 @@ class EgFormTextarea {
|
|
|
42
42
|
...(ngDevMode ? [{ debugName: "rows" }] : /* istanbul ignore next */ []));
|
|
43
43
|
cols = input(undefined, /* @ts-ignore */
|
|
44
44
|
...(ngDevMode ? [{ debugName: "cols" }] : /* istanbul ignore next */ []));
|
|
45
|
+
effectiveId = computed(() => this.controlId() || this.id() || this.generatedId, /* @ts-ignore */
|
|
46
|
+
...(ngDevMode ? [{ debugName: "effectiveId" }] : /* istanbul ignore next */ []));
|
|
47
|
+
errorId = computed(() => `${this.effectiveId()}-error`, /* @ts-ignore */
|
|
48
|
+
...(ngDevMode ? [{ debugName: "errorId" }] : /* istanbul ignore next */ []));
|
|
49
|
+
hintId = computed(() => `${this.effectiveId()}-hint`, /* @ts-ignore */
|
|
50
|
+
...(ngDevMode ? [{ debugName: "hintId" }] : /* istanbul ignore next */ []));
|
|
51
|
+
describedBy() {
|
|
52
|
+
const control = this.formGroupDirective.form.get(this.controlName());
|
|
53
|
+
return this.error() && control?.invalid && (control.dirty || control.touched)
|
|
54
|
+
? this.errorId()
|
|
55
|
+
: this.hint()
|
|
56
|
+
? this.hintId()
|
|
57
|
+
: null;
|
|
58
|
+
}
|
|
59
|
+
effectiveDisabled() {
|
|
60
|
+
return this.disabled() || !!this.formGroupDirective.form.get(this.controlName())?.disabled;
|
|
61
|
+
}
|
|
45
62
|
// Styling classes
|
|
46
63
|
userClass = input('', { ...(ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {}), alias: 'class' });
|
|
47
64
|
labelClass = input('', /* @ts-ignore */
|
|
@@ -63,10 +80,9 @@ class EgFormTextarea {
|
|
|
63
80
|
...(ngDevMode ? [{ debugName: "$errorClass" }] : /* istanbul ignore next */ []));
|
|
64
81
|
$hintClass = computed(() => hlm('tw:mt-0', this.hintClass()), /* @ts-ignore */
|
|
65
82
|
...(ngDevMode ? [{ debugName: "$hintClass" }] : /* istanbul ignore next */ []));
|
|
66
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.
|
|
67
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.
|
|
83
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: EgFormTextarea, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
84
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.3", type: EgFormTextarea, isStandalone: true, selector: "eg-form-textarea", 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 }, 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 }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, rows: { classPropertyName: "rows", publicName: "rows", isSignal: true, isRequired: false, transformFunction: null }, cols: { classPropertyName: "cols", publicName: "cols", 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 }, textareaClass: { classPropertyName: "textareaClass", publicName: "textareaClass", 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: { classAttribute: "tw:w-full" }, providers: [{ provide: ControlContainer, useExisting: FormGroupDirective }], ngImport: i0, template: `
|
|
68
85
|
@let lbl = label();
|
|
69
|
-
@let cid = controlId();
|
|
70
86
|
@let cnm = controlName();
|
|
71
87
|
@let err = error();
|
|
72
88
|
@let hnt = hint();
|
|
@@ -74,23 +90,25 @@ class EgFormTextarea {
|
|
|
74
90
|
|
|
75
91
|
<hlm-form-field>
|
|
76
92
|
@if (lbl) {
|
|
77
|
-
<
|
|
93
|
+
<label hlmLabel [for]="effectiveId()" [class]="$labelClass()"
|
|
78
94
|
>{{ lbl }}
|
|
79
95
|
@if (rqrd) {
|
|
80
96
|
<span class="tw:text-red-500">*</span>
|
|
81
97
|
}
|
|
82
|
-
</
|
|
98
|
+
</label>
|
|
83
99
|
}
|
|
84
100
|
|
|
85
101
|
<textarea
|
|
86
102
|
hlmInput
|
|
87
103
|
[attr.aria-label]="lbl"
|
|
88
|
-
[id]="
|
|
104
|
+
[id]="effectiveId()"
|
|
89
105
|
[name]="cnm || name()"
|
|
90
106
|
[formControlName]="cnm"
|
|
91
107
|
[class]="$textareaClass()"
|
|
92
108
|
[placeholder]="placeholder()"
|
|
93
109
|
[readonly]="readonly()"
|
|
110
|
+
[attr.disabled]="effectiveDisabled() ? '' : null"
|
|
111
|
+
[ariaDescribedby]="describedBy()"
|
|
94
112
|
[maxlength]="maxlength()"
|
|
95
113
|
[minlength]="minlength()"
|
|
96
114
|
[required]="rqrd"
|
|
@@ -99,20 +117,20 @@ class EgFormTextarea {
|
|
|
99
117
|
></textarea>
|
|
100
118
|
|
|
101
119
|
@if (err) {
|
|
102
|
-
<hlm-error [class]="$errorClass()">
|
|
120
|
+
<hlm-error [id]="errorId()" [class]="$errorClass()">
|
|
103
121
|
{{ err }}
|
|
104
122
|
</hlm-error>
|
|
105
123
|
}
|
|
106
124
|
|
|
107
125
|
@if (hnt) {
|
|
108
|
-
<hlm-hint [class]="$hintClass()">
|
|
126
|
+
<hlm-hint [id]="hintId()" [class]="$hintClass()">
|
|
109
127
|
{{ hnt }}
|
|
110
128
|
</hlm-hint>
|
|
111
129
|
}
|
|
112
130
|
</hlm-form-field>
|
|
113
|
-
`, isInline: true, dependencies: [{ kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox]):not([ngNoCva])[formControlName],textarea:not([ngNoCva])[formControlName],input:not([type=checkbox]):not([ngNoCva])[formControl],textarea:not([ngNoCva])[formControl],input:not([type=checkbox]):not([ngNoCva])[ngModel],textarea:not([ngNoCva])[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i1.MinLengthValidator, selector: "[minlength][formControlName],[minlength][formControl],[minlength][ngModel]", inputs: ["minlength"] }, { kind: "directive", type: i1.MaxLengthValidator, selector: "[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]", inputs: ["maxlength"] }, { kind: "directive", type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: HlmFormField, selector: "hlm-form-field", inputs: ["class"] }, { kind: "directive", type: HlmError, selector: "hlm-error", inputs: ["class"] }, { kind: "directive", type: HlmHint, selector: "hlm-hint", inputs: ["class"] }, { kind: "directive", type: HlmLabel, selector: "[hlmLabel]", inputs: ["class"] }, { kind: "directive", type: HlmInput, selector: "[hlmInput]" }] });
|
|
131
|
+
`, isInline: true, dependencies: [{ kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox]):not([ngNoCva])[formControlName],textarea:not([ngNoCva])[formControlName],input:not([type=checkbox]):not([ngNoCva])[formControl],textarea:not([ngNoCva])[formControl],input:not([type=checkbox]):not([ngNoCva])[ngModel],textarea:not([ngNoCva])[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i1.MinLengthValidator, selector: "[minlength][formControlName],[minlength][formControl],[minlength][ngModel]", inputs: ["minlength"] }, { kind: "directive", type: i1.MaxLengthValidator, selector: "[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]", inputs: ["maxlength"] }, { kind: "directive", type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: HlmFormField, selector: "hlm-form-field", inputs: ["class"] }, { kind: "directive", type: HlmError, selector: "hlm-error", inputs: ["class"] }, { kind: "directive", type: HlmHint, selector: "hlm-hint", inputs: ["class"] }, { kind: "directive", type: HlmLabel, selector: "[hlmLabel]", inputs: ["class"] }, { kind: "directive", type: HlmInput, selector: "[hlmInput]", inputs: ["ariaDescribedby"] }] });
|
|
114
132
|
}
|
|
115
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.
|
|
133
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: EgFormTextarea, decorators: [{
|
|
116
134
|
type: Component,
|
|
117
135
|
args: [{
|
|
118
136
|
selector: 'eg-form-textarea',
|
|
@@ -124,7 +142,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.7", ngImpor
|
|
|
124
142
|
providers: [{ provide: ControlContainer, useExisting: FormGroupDirective }],
|
|
125
143
|
template: `
|
|
126
144
|
@let lbl = label();
|
|
127
|
-
@let cid = controlId();
|
|
128
145
|
@let cnm = controlName();
|
|
129
146
|
@let err = error();
|
|
130
147
|
@let hnt = hint();
|
|
@@ -132,23 +149,25 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.7", ngImpor
|
|
|
132
149
|
|
|
133
150
|
<hlm-form-field>
|
|
134
151
|
@if (lbl) {
|
|
135
|
-
<
|
|
152
|
+
<label hlmLabel [for]="effectiveId()" [class]="$labelClass()"
|
|
136
153
|
>{{ lbl }}
|
|
137
154
|
@if (rqrd) {
|
|
138
155
|
<span class="tw:text-red-500">*</span>
|
|
139
156
|
}
|
|
140
|
-
</
|
|
157
|
+
</label>
|
|
141
158
|
}
|
|
142
159
|
|
|
143
160
|
<textarea
|
|
144
161
|
hlmInput
|
|
145
162
|
[attr.aria-label]="lbl"
|
|
146
|
-
[id]="
|
|
163
|
+
[id]="effectiveId()"
|
|
147
164
|
[name]="cnm || name()"
|
|
148
165
|
[formControlName]="cnm"
|
|
149
166
|
[class]="$textareaClass()"
|
|
150
167
|
[placeholder]="placeholder()"
|
|
151
168
|
[readonly]="readonly()"
|
|
169
|
+
[attr.disabled]="effectiveDisabled() ? '' : null"
|
|
170
|
+
[ariaDescribedby]="describedBy()"
|
|
152
171
|
[maxlength]="maxlength()"
|
|
153
172
|
[minlength]="minlength()"
|
|
154
173
|
[required]="rqrd"
|
|
@@ -157,13 +176,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.7", ngImpor
|
|
|
157
176
|
></textarea>
|
|
158
177
|
|
|
159
178
|
@if (err) {
|
|
160
|
-
<hlm-error [class]="$errorClass()">
|
|
179
|
+
<hlm-error [id]="errorId()" [class]="$errorClass()">
|
|
161
180
|
{{ err }}
|
|
162
181
|
</hlm-error>
|
|
163
182
|
}
|
|
164
183
|
|
|
165
184
|
@if (hnt) {
|
|
166
|
-
<hlm-hint [class]="$hintClass()">
|
|
185
|
+
<hlm-hint [id]="hintId()" [class]="$hintClass()">
|
|
167
186
|
{{ hnt }}
|
|
168
187
|
</hlm-hint>
|
|
169
188
|
}
|
|
@@ -181,4 +200,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.7", ngImpor
|
|
|
181
200
|
*/
|
|
182
201
|
|
|
183
202
|
export { EgFormTextarea };
|
|
184
|
-
|
|
203
|
+
|
|
@@ -2,12 +2,14 @@ import * as _angular_core from '@angular/core';
|
|
|
2
2
|
import { ClassValue } from 'clsx';
|
|
3
3
|
|
|
4
4
|
declare class EgFormTextarea {
|
|
5
|
+
private readonly formGroupDirective;
|
|
6
|
+
private readonly generatedId;
|
|
5
7
|
label: _angular_core.InputSignal<string | undefined>;
|
|
6
8
|
controlId: _angular_core.InputSignal<string | undefined>;
|
|
7
9
|
controlName: _angular_core.InputSignal<string>;
|
|
8
10
|
error: _angular_core.InputSignal<string | undefined>;
|
|
9
11
|
hint: _angular_core.InputSignal<string | undefined>;
|
|
10
|
-
id: _angular_core.InputSignal<string>;
|
|
12
|
+
id: _angular_core.InputSignal<string | undefined>;
|
|
11
13
|
name: _angular_core.InputSignal<string | undefined>;
|
|
12
14
|
placeholder: _angular_core.InputSignal<string>;
|
|
13
15
|
readonly: _angular_core.InputSignal<boolean>;
|
|
@@ -17,6 +19,11 @@ declare class EgFormTextarea {
|
|
|
17
19
|
required: _angular_core.InputSignal<boolean>;
|
|
18
20
|
rows: _angular_core.InputSignal<string | number | undefined>;
|
|
19
21
|
cols: _angular_core.InputSignal<string | number | undefined>;
|
|
22
|
+
readonly effectiveId: _angular_core.Signal<string>;
|
|
23
|
+
readonly errorId: _angular_core.Signal<string>;
|
|
24
|
+
readonly hintId: _angular_core.Signal<string>;
|
|
25
|
+
describedBy(): string | null;
|
|
26
|
+
effectiveDisabled(): boolean;
|
|
20
27
|
userClass: _angular_core.InputSignal<ClassValue>;
|
|
21
28
|
labelClass: _angular_core.InputSignal<string>;
|
|
22
29
|
textareaClass: _angular_core.InputSignal<string>;
|