@egose/shadcn-theme-ng-tw 0.1.0 → 0.3.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 +2 -2
- package/accordion/README.md +405 -2
- package/alert/README.md +372 -2
- package/alert/fesm2022/alert.mjs +1 -1
- package/alert-dialog/README.md +471 -5
- package/aspect-ratio/README.md +272 -5
- package/autocomplete/README.md +502 -2
- package/autocomplete/fesm2022/autocomplete.mjs +1 -1
- package/avatar/README.md +357 -5
- package/badge/README.md +318 -2
- package/basic-alert/README.md +353 -2
- package/breadcrumb/README.md +406 -5
- package/button/README.md +482 -2
- package/button/fesm2022/button.mjs +85 -107
- package/button/types/button.d.ts +5 -8
- package/button-group/README.md +318 -5
- package/button-group/fesm2022/button-group.mjs +1 -1
- package/calendar/README.md +357 -2
- package/card/README.md +331 -5
- package/carousel/README.md +333 -5
- package/carousel/fesm2022/carousel.mjs +4 -1
- package/checkbox/README.md +320 -2
- package/checkbox/fesm2022/checkbox.mjs +6 -7
- package/checkbox/types/checkbox.d.ts +1 -1
- package/collapsible/README.md +332 -5
- package/combobox/README.md +507 -5
- package/combobox/fesm2022/combobox.mjs +5 -2
- package/command/README.md +435 -5
- package/confirmation-dialog/README.md +301 -2
- package/context-menu/README.md +366 -5
- package/date-picker/README.md +469 -2
- package/date-picker/fesm2022/date-picker.mjs +150 -32
- package/date-picker/types/date-picker.d.ts +102 -9
- package/dialog/README.md +448 -2
- package/drawer/README.md +395 -5
- package/dropdown-menu/README.md +417 -5
- package/empty/README.md +329 -5
- package/field/README.md +385 -5
- package/form-autocomplete/README.md +177 -0
- package/form-autocomplete/fesm2022/form-autocomplete.mjs +211 -0
- package/form-autocomplete/package.json +24 -0
- package/form-autocomplete/types/form-autocomplete.d.ts +61 -0
- package/form-checkbox/README.md +322 -2
- package/form-checkbox/fesm2022/form-checkbox.mjs +22 -9
- package/form-checkbox/types/form-checkbox.d.ts +23 -4
- package/form-combobox/README.md +202 -0
- package/form-combobox/fesm2022/form-combobox.mjs +273 -0
- package/form-combobox/package.json +24 -0
- package/form-combobox/types/form-combobox.d.ts +73 -0
- package/form-date-picker/README.md +348 -2
- package/form-date-picker/fesm2022/form-date-picker.mjs +60 -16
- package/form-date-picker/types/form-date-picker.d.ts +17 -1
- package/form-date-picker-multi/README.md +191 -0
- package/form-date-picker-multi/fesm2022/form-date-picker-multi.mjs +239 -0
- package/form-date-picker-multi/package.json +24 -0
- package/form-date-picker-multi/types/form-date-picker-multi.d.ts +58 -0
- package/form-date-range-picker/README.md +253 -0
- package/form-date-range-picker/fesm2022/form-date-range-picker.mjs +236 -0
- package/form-date-range-picker/package.json +24 -0
- package/form-date-range-picker/types/form-date-range-picker.d.ts +55 -0
- package/form-field/README.md +356 -2
- package/form-field-simple/README.md +340 -2
- package/form-input-otp/README.md +194 -0
- package/form-input-otp/fesm2022/form-input-otp.mjs +194 -0
- package/form-input-otp/package.json +24 -0
- package/form-input-otp/types/form-input-otp.d.ts +58 -0
- package/form-month-year-picker/README.md +188 -0
- package/form-month-year-picker/fesm2022/form-month-year-picker.mjs +229 -0
- package/form-month-year-picker/package.json +24 -0
- package/form-month-year-picker/types/form-month-year-picker.d.ts +53 -0
- package/form-native-select/README.md +205 -0
- package/form-native-select/fesm2022/form-native-select.mjs +187 -0
- package/form-native-select/package.json +24 -0
- package/form-native-select/types/form-native-select.d.ts +57 -0
- package/form-phone-input/README.md +188 -0
- package/form-phone-input/fesm2022/form-phone-input.mjs +203 -0
- package/form-phone-input/package.json +24 -0
- package/form-phone-input/types/form-phone-input.d.ts +58 -0
- package/form-radio-group/README.md +198 -0
- package/form-radio-group/fesm2022/form-radio-group.mjs +211 -0
- package/form-radio-group/package.json +24 -0
- package/form-radio-group/types/form-radio-group.d.ts +63 -0
- package/form-searchable-multiselect/README.md +371 -2
- package/form-searchable-multiselect/fesm2022/form-searchable-multiselect.mjs +19 -10
- package/form-searchable-multiselect/types/form-searchable-multiselect.d.ts +18 -1
- package/form-select/README.md +360 -2
- package/form-select/fesm2022/form-select.mjs +24 -15
- package/form-select/types/form-select.d.ts +18 -1
- package/form-slider/README.md +182 -0
- package/form-slider/fesm2022/form-slider.mjs +186 -0
- package/form-slider/package.json +24 -0
- package/form-slider/types/form-slider.d.ts +60 -0
- package/form-switch/README.md +173 -0
- package/form-switch/fesm2022/form-switch.mjs +178 -0
- package/form-switch/package.json +24 -0
- package/form-switch/types/form-switch.d.ts +50 -0
- package/form-text-input/README.md +381 -2
- package/form-text-input/fesm2022/form-text-input.mjs +19 -10
- package/form-text-input/types/form-text-input.d.ts +18 -1
- package/form-textarea/README.md +357 -2
- package/form-textarea/fesm2022/form-textarea.mjs +19 -10
- package/form-textarea/types/form-textarea.d.ts +18 -1
- package/form-toggle/README.md +186 -0
- package/form-toggle/fesm2022/form-toggle.mjs +241 -0
- package/form-toggle/package.json +24 -0
- package/form-toggle/types/form-toggle.d.ts +82 -0
- package/form-toggle-group/README.md +176 -0
- package/form-toggle-group/fesm2022/form-toggle-group.mjs +216 -0
- package/form-toggle-group/package.json +24 -0
- package/form-toggle-group/types/form-toggle-group.d.ts +65 -0
- package/hover-card/README.md +256 -5
- package/icon/README.md +239 -2
- package/input/README.md +269 -2
- package/input-group/README.md +335 -5
- package/input-group/fesm2022/input-group.mjs +23 -13
- package/input-group/types/input-group.d.ts +4 -1
- package/input-otp/README.md +375 -5
- package/item/README.md +385 -5
- package/item/fesm2022/item.mjs +3 -3
- package/kbd/README.md +291 -5
- package/label/README.md +272 -2
- package/layout-simple/README.md +193 -2
- package/layout-simple/fesm2022/layout-simple.mjs +877 -409
- package/layout-simple/types/layout-simple.d.ts +174 -137
- package/menu/README.md +417 -2
- package/menubar/README.md +343 -5
- package/native-select/README.md +323 -5
- package/native-select/fesm2022/native-select.mjs +18 -6
- package/native-select/types/native-select.d.ts +7 -2
- package/navigation-menu/README.md +369 -5
- package/package.json +57 -1
- package/pagination/README.md +388 -5
- package/phone-input/README.md +114 -0
- package/phone-input/fesm2022/phone-input.mjs +191 -0
- package/phone-input/package.json +24 -0
- package/phone-input/types/phone-input.d.ts +67 -0
- package/popover/README.md +331 -2
- package/progress/README.md +311 -5
- package/radio-group/README.md +364 -2
- package/radio-group/fesm2022/radio-group.mjs +5 -1
- package/resizable/README.md +269 -5
- package/scroll-area/README.md +233 -5
- package/searchable-multiselect/README.md +323 -2
- package/select/README.md +437 -2
- package/separator/README.md +222 -2
- package/sheet/README.md +311 -2
- package/sheet/fesm2022/sheet.mjs +1 -1
- package/sidebar/README.md +457 -5
- package/skeleton/README.md +217 -5
- package/slider/README.md +273 -5
- package/slider/fesm2022/slider.mjs +17 -13
- package/sonner/README.md +346 -2
- package/spinner/README.md +284 -2
- package/switch/README.md +310 -2
- package/switch/fesm2022/switch.mjs +7 -5
- package/switch/types/switch.d.ts +2 -1
- package/table/README.md +423 -5
- package/tabs/README.md +411 -2
- package/tabs/fesm2022/tabs.mjs +12 -2
- package/textarea/README.md +282 -5
- package/toggle/README.md +270 -5
- package/toggle-group/README.md +340 -5
- package/tooltip/README.md +269 -2
- package/typography/README.md +271 -5
- package/utils/README.md +303 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { inject, input, computed, Component } from '@angular/core';
|
|
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
5
|
import { HlmFormIdGenerator, HlmFormField, HlmError, HlmHint } from '@egose/shadcn-theme-ng-tw/form-field';
|
|
@@ -7,9 +7,18 @@ 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
|
+
const EgFormTextInputConfigToken = new InjectionToken('EgFormTextInputConfig');
|
|
11
|
+
function provideEgFormTextInputConfig(config) {
|
|
12
|
+
return { provide: EgFormTextInputConfigToken, useValue: { ...config } };
|
|
13
|
+
}
|
|
14
|
+
function injectEgFormTextInputConfig() {
|
|
15
|
+
return inject(EgFormTextInputConfigToken, { optional: true }) ?? {};
|
|
16
|
+
}
|
|
17
|
+
|
|
10
18
|
class EgFormTextInput {
|
|
11
19
|
formGroupDirective = inject(FormGroupDirective);
|
|
12
20
|
generatedId = inject(HlmFormIdGenerator).generate('eg-form-text-input');
|
|
21
|
+
_config = injectEgFormTextInputConfig();
|
|
13
22
|
label = input(undefined, /* @ts-ignore */
|
|
14
23
|
...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
15
24
|
controlId = input(undefined, /* @ts-ignore */
|
|
@@ -76,19 +85,19 @@ class EgFormTextInput {
|
|
|
76
85
|
...(ngDevMode ? [{ debugName: "errorClass" }] : /* istanbul ignore next */ []));
|
|
77
86
|
hintClass = input('', /* @ts-ignore */
|
|
78
87
|
...(ngDevMode ? [{ debugName: "hintClass" }] : /* istanbul ignore next */ []));
|
|
79
|
-
// Computed class bindings
|
|
80
|
-
$userClass = computed(() => hlm('tw:
|
|
88
|
+
// Computed class bindings (library base < global config < per-instance)
|
|
89
|
+
$userClass = computed(() => hlm('tw:w-full', this.userClass()), /* @ts-ignore */
|
|
81
90
|
...(ngDevMode ? [{ debugName: "$userClass" }] : /* istanbul ignore next */ []));
|
|
82
|
-
$labelClass = computed(() => hlm('tw:mb-1 tw:gap-0', this.labelClass()), /* @ts-ignore */
|
|
91
|
+
$labelClass = computed(() => hlm('tw:mb-1 tw:gap-0', this._config.labelClass, this.labelClass()), /* @ts-ignore */
|
|
83
92
|
...(ngDevMode ? [{ debugName: "$labelClass" }] : /* istanbul ignore next */ []));
|
|
84
|
-
$inputClass = computed(() => hlm('tw:mb-1', this.inputClass()), /* @ts-ignore */
|
|
93
|
+
$inputClass = computed(() => hlm('tw:mb-1', this._config.inputClass, this.inputClass()), /* @ts-ignore */
|
|
85
94
|
...(ngDevMode ? [{ debugName: "$inputClass" }] : /* istanbul ignore next */ []));
|
|
86
|
-
$errorClass = computed(() => hlm('tw:mt-0', this.errorClass()), /* @ts-ignore */
|
|
95
|
+
$errorClass = computed(() => hlm('tw:mt-0', this._config.errorClass, this.errorClass()), /* @ts-ignore */
|
|
87
96
|
...(ngDevMode ? [{ debugName: "$errorClass" }] : /* istanbul ignore next */ []));
|
|
88
|
-
$hintClass = computed(() => hlm('tw:mt-0', this.hintClass()), /* @ts-ignore */
|
|
97
|
+
$hintClass = computed(() => hlm('tw:mt-0', this._config.hintClass, this.hintClass()), /* @ts-ignore */
|
|
89
98
|
...(ngDevMode ? [{ debugName: "$hintClass" }] : /* istanbul ignore next */ []));
|
|
90
99
|
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: {
|
|
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: `
|
|
92
101
|
@let lbl = label();
|
|
93
102
|
@let cnm = controlName();
|
|
94
103
|
@let err = error();
|
|
@@ -147,7 +156,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImpor
|
|
|
147
156
|
selector: 'eg-form-text-input',
|
|
148
157
|
standalone: true,
|
|
149
158
|
host: {
|
|
150
|
-
class: '
|
|
159
|
+
'[class]': '$userClass()',
|
|
151
160
|
},
|
|
152
161
|
imports: [ReactiveFormsModule, HlmFormField, HlmError, HlmHint, HlmLabel, HlmInput],
|
|
153
162
|
providers: [{ provide: ControlContainer, useExisting: FormGroupDirective }],
|
|
@@ -214,5 +223,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImpor
|
|
|
214
223
|
* Generated bundle index. Do not edit.
|
|
215
224
|
*/
|
|
216
225
|
|
|
217
|
-
export { EgFormTextInput };
|
|
226
|
+
export { EgFormTextInput, injectEgFormTextInputConfig, provideEgFormTextInputConfig };
|
|
218
227
|
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import * as _angular_core from '@angular/core';
|
|
2
|
+
import { ValueProvider } from '@angular/core';
|
|
2
3
|
import { ClassValue } from 'clsx';
|
|
3
4
|
|
|
4
5
|
declare class EgFormTextInput {
|
|
5
6
|
private readonly formGroupDirective;
|
|
6
7
|
private readonly generatedId;
|
|
8
|
+
private readonly _config;
|
|
7
9
|
label: _angular_core.InputSignal<string | undefined>;
|
|
8
10
|
controlId: _angular_core.InputSignal<string | undefined>;
|
|
9
11
|
controlName: _angular_core.InputSignal<string>;
|
|
@@ -42,4 +44,19 @@ declare class EgFormTextInput {
|
|
|
42
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>;
|
|
43
45
|
}
|
|
44
46
|
|
|
45
|
-
|
|
47
|
+
interface EgFormTextInputConfig {
|
|
48
|
+
/**
|
|
49
|
+
* Global class defaults for `eg-form-text-input` styling slots.
|
|
50
|
+
* Each is merged under the matching per-instance `*Class` input
|
|
51
|
+
* (library base < global config < per-instance).
|
|
52
|
+
*/
|
|
53
|
+
labelClass?: string;
|
|
54
|
+
inputClass?: string;
|
|
55
|
+
errorClass?: string;
|
|
56
|
+
hintClass?: string;
|
|
57
|
+
}
|
|
58
|
+
declare function provideEgFormTextInputConfig(config: Partial<EgFormTextInputConfig>): ValueProvider;
|
|
59
|
+
declare function injectEgFormTextInputConfig(): EgFormTextInputConfig;
|
|
60
|
+
|
|
61
|
+
export { EgFormTextInput, injectEgFormTextInputConfig, provideEgFormTextInputConfig };
|
|
62
|
+
export type { EgFormTextInputConfig };
|
package/form-textarea/README.md
CHANGED
|
@@ -1,3 +1,358 @@
|
|
|
1
|
-
# Form Textarea
|
|
1
|
+
# Form Textarea (`@egose/shadcn-theme-ng/form-textarea`)
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
`EgFormTextarea` is a reactive-forms wrapper that bundles a `<label>`, a styled `<textarea hlmInput>`, and error/hint text into one form-ready row. It is the Angular equivalent of shadcn/ui's `<FormField> + <Textarea>` pattern for multiline input (comments, descriptions, bios), with generated ids, `aria-describedby` wiring, and `disabled` resolution handled for you.
|
|
4
|
+
|
|
5
|
+
> **Ships as:** `@egose/shadcn-theme-ng/form-textarea` (plain Tailwind) and `@egose/shadcn-theme-ng-tw/form-textarea` (`tw:`-prefixed variant). See the [package README](../../README.md) for installation, peer dependencies, and the Tailwind-variant contract. Do not publish this project directory independently.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
# Plain Tailwind (no prefix)
|
|
11
|
+
npm install @egose/shadcn-theme-ng
|
|
12
|
+
|
|
13
|
+
# Or the tw:-prefixed variant
|
|
14
|
+
npm install @egose/shadcn-theme-ng-tw
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Peer dependencies (Angular, `@angular/forms`, CDK, `@spartan-ng/brain`, `rxjs`) are documented in the [package README](../../README.md#peer-dependencies).
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
import { EgFormTextarea } from '@egose/shadcn-theme-ng/form-textarea';
|
|
21
|
+
// tw variant:
|
|
22
|
+
// import { EgFormTextarea } from '@egose/shadcn-theme-ng-tw/form-textarea';
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Imports
|
|
26
|
+
|
|
27
|
+
The public API (`src/public-api.ts`) exports exactly one symbol — the standalone component `EgFormTextarea`. There is no `*Imports` array and no `*Module` for this subpath; import the component class directly.
|
|
28
|
+
|
|
29
|
+
```ts
|
|
30
|
+
import { EgFormTextarea } from '@egose/shadcn-theme-ng/form-textarea';
|
|
31
|
+
|
|
32
|
+
@Component({
|
|
33
|
+
standalone: true,
|
|
34
|
+
imports: [ReactiveFormsModule, EgFormTextarea],
|
|
35
|
+
template: `
|
|
36
|
+
<form [formGroup]="form">
|
|
37
|
+
<eg-form-textarea controlName="bio" label="Bio" placeholder="Tell us about yourself" />
|
|
38
|
+
</form>
|
|
39
|
+
`,
|
|
40
|
+
})
|
|
41
|
+
export class MyForm {}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Requirements:
|
|
45
|
+
|
|
46
|
+
- Must sit inside a `<form [formGroup]>` (it injects `FormGroupDirective` and provides `ControlContainer`).
|
|
47
|
+
- `controlName` is required — forwarded as `[formControlName]` to the inner `<textarea>`.
|
|
48
|
+
- The bound `FormControl` holds a `string`.
|
|
49
|
+
|
|
50
|
+
## Anatomy / Structure
|
|
51
|
+
|
|
52
|
+
```html
|
|
53
|
+
<eg-form-textarea controlName="bio" label="Bio">
|
|
54
|
+
<!-- rendered internally -->
|
|
55
|
+
<hlm-form-field>
|
|
56
|
+
<label hlmLabel for="<effectiveId>">Bio <span>*</span></label>
|
|
57
|
+
<textarea
|
|
58
|
+
hlmInput
|
|
59
|
+
id="<effectiveId>"
|
|
60
|
+
name="bio"
|
|
61
|
+
formControlName="bio"
|
|
62
|
+
rows="3"
|
|
63
|
+
placeholder="…"
|
|
64
|
+
aria-describedby="<effectiveId>-error | <effectiveId>-hint"
|
|
65
|
+
></textarea>
|
|
66
|
+
<hlm-error id="<effectiveId>-error">…</hlm-error>
|
|
67
|
+
<hlm-hint id="<effectiveId>-hint">…</hlm-hint>
|
|
68
|
+
</hlm-form-field>
|
|
69
|
+
</eg-form-textarea>
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Real selectors: `eg-form-textarea`, `hlm-form-field`, `label[hlmLabel]`, `textarea[hlmInput]`, `hlm-error`, `hlm-hint`. Note the inner textarea reuses the `hlmInput` styling directive (same class hook as single-line inputs).
|
|
73
|
+
|
|
74
|
+
## API reference
|
|
75
|
+
|
|
76
|
+
### `eg-form-textarea` — `EgFormTextarea`
|
|
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
|
+
| `hint` | `string \| undefined` | `undefined` | Hint text rendered in `<hlm-hint>`. |
|
|
86
|
+
| `name` | `string \| undefined` | `undefined` | `name` attribute fallback when `controlName` is empty. |
|
|
87
|
+
| `placeholder` | `string` | `''` | Placeholder text. |
|
|
88
|
+
| `readonly` | `boolean` | `false` | Native `readonly` attribute. |
|
|
89
|
+
| `disabled` | `boolean` | `false` | Wrapper-level disable (OR-ed with the reactive disabled state — see `effectiveDisabled()`). |
|
|
90
|
+
| `maxlength` | `string \| number \| null` | `null` | Native `maxlength`. |
|
|
91
|
+
| `minlength` | `string \| number \| null` | `null` | Native `minlength`. |
|
|
92
|
+
| `required` | `boolean` | `false` | Native `required` + red `*` on the label. |
|
|
93
|
+
| `rows` | `string \| number \| undefined` | `3` | Native `rows` (visible height). |
|
|
94
|
+
| `cols` | `string \| number \| undefined` | `undefined` | Native `cols` (visible width). |
|
|
95
|
+
| `class` (`userClass`) | `ClassValue` | `''` | Extra host classes (merged over `tw:w-full`). |
|
|
96
|
+
| `labelClass` | `string` | `''` | Extra label classes (merged over `tw:mb-1 tw:gap-0`). |
|
|
97
|
+
| `textareaClass` | `string` | `''` | Extra textarea classes (merged over `tw:mb-1`). |
|
|
98
|
+
| `errorClass` | `string` | `''` | Extra error classes (merged over `tw:mt-0`). |
|
|
99
|
+
| `hintClass` | `string` | `''` | Extra hint classes (merged over `tw:mt-0`). |
|
|
100
|
+
|
|
101
|
+
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
|
+
## Examples
|
|
104
|
+
|
|
105
|
+
### 1. Basic comment box
|
|
106
|
+
|
|
107
|
+
```ts
|
|
108
|
+
import { Component } from '@angular/core';
|
|
109
|
+
import { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms';
|
|
110
|
+
import { EgFormTextarea } from '@egose/shadcn-theme-ng/form-textarea';
|
|
111
|
+
|
|
112
|
+
@Component({
|
|
113
|
+
standalone: true,
|
|
114
|
+
imports: [ReactiveFormsModule, EgFormTextarea],
|
|
115
|
+
template: `
|
|
116
|
+
<form [formGroup]="form" (ngSubmit)="post()">
|
|
117
|
+
<eg-form-textarea controlName="comment" label="Comment" placeholder="Write a comment…" [rows]="4" />
|
|
118
|
+
<button type="submit">Post</button>
|
|
119
|
+
</form>
|
|
120
|
+
`,
|
|
121
|
+
})
|
|
122
|
+
export class BasicExample {
|
|
123
|
+
readonly form = new FormGroup({
|
|
124
|
+
comment: new FormControl<string>('', { nonNullable: true }),
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
post() {
|
|
128
|
+
console.log(this.form.value.comment);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### 2. Sizes via `rows` / `cols` / `textareaClass`
|
|
134
|
+
|
|
135
|
+
```ts
|
|
136
|
+
import { Component } from '@angular/core';
|
|
137
|
+
import { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms';
|
|
138
|
+
import { EgFormTextarea } from '@egose/shadcn-theme-ng/form-textarea';
|
|
139
|
+
|
|
140
|
+
@Component({
|
|
141
|
+
standalone: true,
|
|
142
|
+
imports: [ReactiveFormsModule, EgFormTextarea],
|
|
143
|
+
template: `
|
|
144
|
+
<form [formGroup]="form" class="tw:grid tw:gap-4">
|
|
145
|
+
<eg-form-textarea controlName="short" label="Compact (2 rows)" [rows]="2" />
|
|
146
|
+
<eg-form-textarea controlName="default" label="Default (3 rows)" />
|
|
147
|
+
<eg-form-textarea controlName="tall" label="Tall composer" [rows]="8" textareaClass="tw:resize-y tw:min-h-40" />
|
|
148
|
+
</form>
|
|
149
|
+
`,
|
|
150
|
+
})
|
|
151
|
+
export class SizesExample {
|
|
152
|
+
readonly form = new FormGroup({
|
|
153
|
+
short: new FormControl<string>('', { nonNullable: true }),
|
|
154
|
+
default: new FormControl<string>('', { nonNullable: true }),
|
|
155
|
+
tall: new FormControl<string>('', { nonNullable: true }),
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
### 3. Validation with a live character counter
|
|
161
|
+
|
|
162
|
+
```ts
|
|
163
|
+
import { Component } from '@angular/core';
|
|
164
|
+
import { FormControl, FormGroup, ReactiveFormsModule, Validators } from '@angular/forms';
|
|
165
|
+
import { EgFormTextarea } from '@egose/shadcn-theme-ng/form-textarea';
|
|
166
|
+
|
|
167
|
+
@Component({
|
|
168
|
+
standalone: true,
|
|
169
|
+
imports: [ReactiveFormsModule, EgFormTextarea],
|
|
170
|
+
template: `
|
|
171
|
+
<form [formGroup]="form" (ngSubmit)="submit()">
|
|
172
|
+
<eg-form-textarea
|
|
173
|
+
controlName="bio"
|
|
174
|
+
label="Bio"
|
|
175
|
+
placeholder="A few sentences about you"
|
|
176
|
+
[rows]="5"
|
|
177
|
+
[maxlength]="280"
|
|
178
|
+
[hint]="counter()"
|
|
179
|
+
error="Bio must be 20–280 characters"
|
|
180
|
+
required
|
|
181
|
+
/>
|
|
182
|
+
<button type="submit" [disabled]="form.invalid">Save</button>
|
|
183
|
+
</form>
|
|
184
|
+
`,
|
|
185
|
+
})
|
|
186
|
+
export class CounterExample {
|
|
187
|
+
readonly form = new FormGroup({
|
|
188
|
+
bio: new FormControl<string>('', {
|
|
189
|
+
nonNullable: true,
|
|
190
|
+
validators: [Validators.required, Validators.minLength(20), Validators.maxLength(280)],
|
|
191
|
+
}),
|
|
192
|
+
});
|
|
193
|
+
|
|
194
|
+
counter(): string {
|
|
195
|
+
return `${this.form.controls.bio.value.length}/280`;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
submit() {
|
|
199
|
+
if (this.form.invalid) {
|
|
200
|
+
this.form.markAllAsTouched();
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
### 4. Disabled and readonly states
|
|
208
|
+
|
|
209
|
+
```ts
|
|
210
|
+
import { Component, signal } from '@angular/core';
|
|
211
|
+
import { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms';
|
|
212
|
+
import { EgFormTextarea } from '@egose/shadcn-theme-ng/form-textarea';
|
|
213
|
+
|
|
214
|
+
@Component({
|
|
215
|
+
standalone: true,
|
|
216
|
+
imports: [ReactiveFormsModule, EgFormTextarea],
|
|
217
|
+
template: `
|
|
218
|
+
<form [formGroup]="form">
|
|
219
|
+
<eg-form-textarea
|
|
220
|
+
controlName="notes"
|
|
221
|
+
label="Internal notes"
|
|
222
|
+
[rows]="4"
|
|
223
|
+
[disabled]="locked()"
|
|
224
|
+
hint="Toggle the lock to edit"
|
|
225
|
+
/>
|
|
226
|
+
<eg-form-textarea controlName="audit" label="Audit trail" [rows]="3" [readonly]="true" />
|
|
227
|
+
<button type="button" (click)="locked.update((v) => !v)">Toggle lock</button>
|
|
228
|
+
</form>
|
|
229
|
+
`,
|
|
230
|
+
})
|
|
231
|
+
export class StatesExample {
|
|
232
|
+
readonly form = new FormGroup({
|
|
233
|
+
notes: new FormControl<string>('Called back twice.', { nonNullable: true }),
|
|
234
|
+
audit: new FormControl<string>('Created 2026-09-01 · Updated 2026-09-20', { nonNullable: true }),
|
|
235
|
+
});
|
|
236
|
+
readonly locked = signal(true);
|
|
237
|
+
}
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
### 5. Feedback form composition (input + textarea + select-side hint)
|
|
241
|
+
|
|
242
|
+
```ts
|
|
243
|
+
import { Component } from '@angular/core';
|
|
244
|
+
import { FormControl, FormGroup, ReactiveFormsModule, Validators } from '@angular/forms';
|
|
245
|
+
import { EgFormTextInput } from '@egose/shadcn-theme-ng/form-text-input';
|
|
246
|
+
import { EgFormTextarea } from '@egose/shadcn-theme-ng/form-textarea';
|
|
247
|
+
|
|
248
|
+
@Component({
|
|
249
|
+
standalone: true,
|
|
250
|
+
imports: [ReactiveFormsModule, EgFormTextInput, EgFormTextarea],
|
|
251
|
+
template: `
|
|
252
|
+
<form [formGroup]="form" (ngSubmit)="send()" class="tw:grid tw:gap-4">
|
|
253
|
+
<eg-form-text-input controlName="subject" label="Subject" required />
|
|
254
|
+
<eg-form-textarea
|
|
255
|
+
controlName="message"
|
|
256
|
+
label="Message"
|
|
257
|
+
placeholder="Describe the issue in detail…"
|
|
258
|
+
[rows]="6"
|
|
259
|
+
[maxlength]="2000"
|
|
260
|
+
[hint]="messageHint()"
|
|
261
|
+
error="Message is required (min 20 characters)"
|
|
262
|
+
required
|
|
263
|
+
/>
|
|
264
|
+
<button type="submit">Send feedback</button>
|
|
265
|
+
</form>
|
|
266
|
+
`,
|
|
267
|
+
})
|
|
268
|
+
export class FeedbackExample {
|
|
269
|
+
readonly form = new FormGroup({
|
|
270
|
+
subject: new FormControl<string>('', { nonNullable: true, validators: Validators.required }),
|
|
271
|
+
message: new FormControl<string>('', {
|
|
272
|
+
nonNullable: true,
|
|
273
|
+
validators: [Validators.required, Validators.minLength(20), Validators.maxLength(2000)],
|
|
274
|
+
}),
|
|
275
|
+
});
|
|
276
|
+
|
|
277
|
+
messageHint(): string {
|
|
278
|
+
return `${this.form.controls.message.value.length}/2000 · Markdown supported`;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
send() {
|
|
282
|
+
if (this.form.invalid) {
|
|
283
|
+
this.form.markAllAsTouched();
|
|
284
|
+
return;
|
|
285
|
+
}
|
|
286
|
+
console.log(this.form.getRawValue());
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
### 6. Programmatic control (templates, reset, autosize note)
|
|
292
|
+
|
|
293
|
+
There is no auto-grow behavior — height is fixed by `rows` (plus `textareaClass` resize utilities). Insert canned text and reset programmatically:
|
|
294
|
+
|
|
295
|
+
```ts
|
|
296
|
+
import { Component } from '@angular/core';
|
|
297
|
+
import { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms';
|
|
298
|
+
import { EgFormTextarea } from '@egose/shadcn-theme-ng/form-textarea';
|
|
299
|
+
|
|
300
|
+
@Component({
|
|
301
|
+
standalone: true,
|
|
302
|
+
imports: [ReactiveFormsModule, EgFormTextarea],
|
|
303
|
+
template: `
|
|
304
|
+
<form [formGroup]="form">
|
|
305
|
+
<eg-form-textarea
|
|
306
|
+
#descField
|
|
307
|
+
controlName="description"
|
|
308
|
+
label="Description"
|
|
309
|
+
[rows]="6"
|
|
310
|
+
textareaClass="tw:resize-y"
|
|
311
|
+
hint="Tip: allow vertical resize for long drafts"
|
|
312
|
+
/>
|
|
313
|
+
<div class="tw:flex tw:gap-2">
|
|
314
|
+
<button type="button" (click)="insertTemplate()">Insert template</button>
|
|
315
|
+
<button type="button" (click)="form.controls.description.reset()">Clear</button>
|
|
316
|
+
</div>
|
|
317
|
+
<p>Field id: {{ descField.effectiveId() }}</p>
|
|
318
|
+
</form>
|
|
319
|
+
`,
|
|
320
|
+
})
|
|
321
|
+
export class ProgrammaticExample {
|
|
322
|
+
readonly form = new FormGroup({
|
|
323
|
+
description: new FormControl<string>('', { nonNullable: true }),
|
|
324
|
+
});
|
|
325
|
+
|
|
326
|
+
insertTemplate() {
|
|
327
|
+
this.form.controls.description.setValue('## Summary\n\n## Steps to reproduce\n\n1. \n2. \n');
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
## Accessibility notes
|
|
333
|
+
|
|
334
|
+
- `<label [for]>` targets the textarea id (explicit `controlId`/`id` or generated), so label clicks focus the field.
|
|
335
|
+
- `aria-describedby` points at the error element only when invalid and dirty/touched, otherwise at the hint — pair long hints (formatting tips, counters) with concise `error` strings so screen-reader users hear the failure, not the help text, on error.
|
|
336
|
+
- The textarea reuses `HlmInput` styling (spartan invalid-state hooks included). Use `maxlength` + a counter hint for constrained fields so users get feedback before hitting the native limit.
|
|
337
|
+
- Avoid `autofocus`-style behavior here (the component exposes none) — move focus deliberately in wizards instead.
|
|
338
|
+
|
|
339
|
+
## Theming / CSS variables
|
|
340
|
+
|
|
341
|
+
No component-specific CSS variables; visuals come from the shared theme tokens via the `hlmInput` class hook. Control height with `rows` and `textareaClass` (`tw:min-h-*`, `tw:resize-y` / `tw:resize-none`).
|
|
342
|
+
|
|
343
|
+
Global defaults per styling slot via the wrapper config (precedence: library base < global config < per-instance):
|
|
344
|
+
|
|
345
|
+
```ts
|
|
346
|
+
import { provideEgFormTextareaConfig } from '@egose/shadcn-theme-ng/form-textarea';
|
|
347
|
+
|
|
348
|
+
await bootstrapApplication(App, {
|
|
349
|
+
providers: [provideEgFormTextareaConfig({ textareaClass: 'tw:text-sm', labelClass: 'tw:font-medium' })],
|
|
350
|
+
});
|
|
351
|
+
```
|
|
352
|
+
|
|
353
|
+
## Related subpaths
|
|
354
|
+
|
|
355
|
+
- `@egose/shadcn-theme-ng/form-text-input` — the single-line sibling.
|
|
356
|
+
- `@egose/shadcn-theme-ng/textarea` — the raw `HlmTextarea` directive for non-form usage.
|
|
357
|
+
- `@egose/shadcn-theme-ng/input` — `HlmInput`, the class hook shared by both.
|
|
358
|
+
- `@egose/shadcn-theme-ng/form-field` — `HlmFormField`, `HlmError`, `HlmHint`, `HlmFormIdGenerator`.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { inject, input, computed, Component } from '@angular/core';
|
|
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
5
|
import { HlmFormIdGenerator, HlmFormField, HlmError, HlmHint } from '@egose/shadcn-theme-ng-tw/form-field';
|
|
@@ -7,9 +7,18 @@ 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
|
+
const EgFormTextareaConfigToken = new InjectionToken('EgFormTextareaConfig');
|
|
11
|
+
function provideEgFormTextareaConfig(config) {
|
|
12
|
+
return { provide: EgFormTextareaConfigToken, useValue: { ...config } };
|
|
13
|
+
}
|
|
14
|
+
function injectEgFormTextareaConfig() {
|
|
15
|
+
return inject(EgFormTextareaConfigToken, { optional: true }) ?? {};
|
|
16
|
+
}
|
|
17
|
+
|
|
10
18
|
class EgFormTextarea {
|
|
11
19
|
formGroupDirective = inject(FormGroupDirective);
|
|
12
20
|
generatedId = inject(HlmFormIdGenerator).generate('eg-form-textarea');
|
|
21
|
+
_config = injectEgFormTextareaConfig();
|
|
13
22
|
// General props
|
|
14
23
|
label = input(undefined, /* @ts-ignore */
|
|
15
24
|
...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
@@ -69,19 +78,19 @@ class EgFormTextarea {
|
|
|
69
78
|
...(ngDevMode ? [{ debugName: "errorClass" }] : /* istanbul ignore next */ []));
|
|
70
79
|
hintClass = input('', /* @ts-ignore */
|
|
71
80
|
...(ngDevMode ? [{ debugName: "hintClass" }] : /* istanbul ignore next */ []));
|
|
72
|
-
// Computed class bindings
|
|
73
|
-
$userClass = computed(() => hlm('tw:
|
|
81
|
+
// Computed class bindings (library base < global config < per-instance)
|
|
82
|
+
$userClass = computed(() => hlm('tw:w-full', this.userClass()), /* @ts-ignore */
|
|
74
83
|
...(ngDevMode ? [{ debugName: "$userClass" }] : /* istanbul ignore next */ []));
|
|
75
|
-
$labelClass = computed(() => hlm('tw:mb-1 tw:gap-0', this.labelClass()), /* @ts-ignore */
|
|
84
|
+
$labelClass = computed(() => hlm('tw:mb-1 tw:gap-0', this._config.labelClass, this.labelClass()), /* @ts-ignore */
|
|
76
85
|
...(ngDevMode ? [{ debugName: "$labelClass" }] : /* istanbul ignore next */ []));
|
|
77
|
-
$textareaClass = computed(() => hlm('tw:mb-1', this.textareaClass()), /* @ts-ignore */
|
|
86
|
+
$textareaClass = computed(() => hlm('tw:mb-1', this._config.textareaClass, this.textareaClass()), /* @ts-ignore */
|
|
78
87
|
...(ngDevMode ? [{ debugName: "$textareaClass" }] : /* istanbul ignore next */ []));
|
|
79
|
-
$errorClass = computed(() => hlm('tw:mt-0', this.errorClass()), /* @ts-ignore */
|
|
88
|
+
$errorClass = computed(() => hlm('tw:mt-0', this._config.errorClass, this.errorClass()), /* @ts-ignore */
|
|
80
89
|
...(ngDevMode ? [{ debugName: "$errorClass" }] : /* istanbul ignore next */ []));
|
|
81
|
-
$hintClass = computed(() => hlm('tw:mt-0', this.hintClass()), /* @ts-ignore */
|
|
90
|
+
$hintClass = computed(() => hlm('tw:mt-0', this._config.hintClass, this.hintClass()), /* @ts-ignore */
|
|
82
91
|
...(ngDevMode ? [{ debugName: "$hintClass" }] : /* istanbul ignore next */ []));
|
|
83
92
|
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: {
|
|
93
|
+
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: { properties: { "class": "$userClass()" } }, providers: [{ provide: ControlContainer, useExisting: FormGroupDirective }], ngImport: i0, template: `
|
|
85
94
|
@let lbl = label();
|
|
86
95
|
@let cnm = controlName();
|
|
87
96
|
@let err = error();
|
|
@@ -136,7 +145,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImpor
|
|
|
136
145
|
selector: 'eg-form-textarea',
|
|
137
146
|
standalone: true,
|
|
138
147
|
host: {
|
|
139
|
-
class: '
|
|
148
|
+
'[class]': '$userClass()',
|
|
140
149
|
},
|
|
141
150
|
imports: [ReactiveFormsModule, HlmFormField, HlmError, HlmHint, HlmLabel, HlmInput],
|
|
142
151
|
providers: [{ provide: ControlContainer, useExisting: FormGroupDirective }],
|
|
@@ -199,5 +208,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImpor
|
|
|
199
208
|
* Generated bundle index. Do not edit.
|
|
200
209
|
*/
|
|
201
210
|
|
|
202
|
-
export { EgFormTextarea };
|
|
211
|
+
export { EgFormTextarea, injectEgFormTextareaConfig, provideEgFormTextareaConfig };
|
|
203
212
|
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import * as _angular_core from '@angular/core';
|
|
2
|
+
import { ValueProvider } from '@angular/core';
|
|
2
3
|
import { ClassValue } from 'clsx';
|
|
3
4
|
|
|
4
5
|
declare class EgFormTextarea {
|
|
5
6
|
private readonly formGroupDirective;
|
|
6
7
|
private readonly generatedId;
|
|
8
|
+
private readonly _config;
|
|
7
9
|
label: _angular_core.InputSignal<string | undefined>;
|
|
8
10
|
controlId: _angular_core.InputSignal<string | undefined>;
|
|
9
11
|
controlName: _angular_core.InputSignal<string>;
|
|
@@ -38,4 +40,19 @@ declare class EgFormTextarea {
|
|
|
38
40
|
static ɵcmp: _angular_core.ɵɵComponentDeclaration<EgFormTextarea, "eg-form-textarea", 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; }; "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; }; "required": { "alias": "required"; "required": false; "isSignal": true; }; "rows": { "alias": "rows"; "required": false; "isSignal": true; }; "cols": { "alias": "cols"; "required": false; "isSignal": true; }; "userClass": { "alias": "class"; "required": false; "isSignal": true; }; "labelClass": { "alias": "labelClass"; "required": false; "isSignal": true; }; "textareaClass": { "alias": "textareaClass"; "required": false; "isSignal": true; }; "errorClass": { "alias": "errorClass"; "required": false; "isSignal": true; }; "hintClass": { "alias": "hintClass"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
39
41
|
}
|
|
40
42
|
|
|
41
|
-
|
|
43
|
+
interface EgFormTextareaConfig {
|
|
44
|
+
/**
|
|
45
|
+
* Global class defaults for `eg-form-textarea` styling slots.
|
|
46
|
+
* Each is merged under the matching per-instance `*Class` input
|
|
47
|
+
* (library base < global config < per-instance).
|
|
48
|
+
*/
|
|
49
|
+
labelClass?: string;
|
|
50
|
+
textareaClass?: string;
|
|
51
|
+
errorClass?: string;
|
|
52
|
+
hintClass?: string;
|
|
53
|
+
}
|
|
54
|
+
declare function provideEgFormTextareaConfig(config: Partial<EgFormTextareaConfig>): ValueProvider;
|
|
55
|
+
declare function injectEgFormTextareaConfig(): EgFormTextareaConfig;
|
|
56
|
+
|
|
57
|
+
export { EgFormTextarea, injectEgFormTextareaConfig, provideEgFormTextareaConfig };
|
|
58
|
+
export type { EgFormTextareaConfig };
|