@egose/shadcn-theme-ng 0.2.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 +1 -1
- package/autocomplete/fesm2022/autocomplete.mjs +1 -1
- package/checkbox/fesm2022/checkbox.mjs +6 -7
- package/checkbox/types/checkbox.d.ts +1 -1
- package/combobox/fesm2022/combobox.mjs +1 -1
- package/date-picker/README.md +15 -11
- package/date-picker/fesm2022/date-picker.mjs +148 -30
- package/date-picker/types/date-picker.d.ts +102 -9
- package/form-autocomplete/README.md +177 -0
- package/form-autocomplete/fesm2022/form-autocomplete.mjs +125 -0
- package/form-autocomplete/package.json +24 -0
- package/form-autocomplete/types/form-autocomplete.d.ts +61 -0
- package/form-checkbox/README.md +13 -3
- 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 +147 -0
- package/form-combobox/package.json +24 -0
- package/form-combobox/types/form-combobox.d.ts +73 -0
- package/form-date-picker/README.md +48 -22
- package/form-date-picker/fesm2022/form-date-picker.mjs +38 -12
- 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 +129 -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 +130 -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-input-otp/README.md +194 -0
- package/form-input-otp/fesm2022/form-input-otp.mjs +106 -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 +125 -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 +103 -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 +113 -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 +111 -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 +11 -1
- 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 +10 -0
- package/form-select/fesm2022/form-select.mjs +20 -11
- package/form-select/types/form-select.d.ts +18 -1
- package/form-slider/README.md +182 -0
- package/form-slider/fesm2022/form-slider.mjs +106 -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 +100 -0
- package/form-switch/package.json +24 -0
- package/form-switch/types/form-switch.d.ts +50 -0
- package/form-text-input/README.md +10 -0
- 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 +11 -1
- 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 +159 -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 +116 -0
- package/form-toggle-group/package.json +24 -0
- package/form-toggle-group/types/form-toggle-group.d.ts +65 -0
- package/input-group/fesm2022/input-group.mjs +19 -9
- package/input-group/types/input-group.d.ts +4 -1
- package/native-select/fesm2022/native-select.mjs +18 -6
- package/native-select/types/native-select.d.ts +7 -2
- package/package.json +57 -1
- 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/radio-group/types/radio-group.d.ts +1 -1
- package/switch/fesm2022/switch.mjs +7 -5
- package/switch/types/switch.d.ts +2 -1
- package/typography/types/typography.d.ts +8 -8
package/form-checkbox/README.md
CHANGED
|
@@ -98,8 +98,8 @@ Selector (from source): `eg-form-checkbox` (standalone component).
|
|
|
98
98
|
| `class` | `ClassValue` | `''` | Extra host classes. |
|
|
99
99
|
| `checkboxClass` | `string` | `''` | Extra classes for `hlm-checkbox`. |
|
|
100
100
|
| `labelClass` | `string` | `''` | Extra classes for the label. |
|
|
101
|
-
|
|
|
102
|
-
|
|
|
101
|
+
| `errorClass` | `string` | `''` | Extra classes for `hlm-error`. |
|
|
102
|
+
| `hintClass` | `string` | `''` | Extra classes for `hlm-hint`. |
|
|
103
103
|
|
|
104
104
|
| Member | Description |
|
|
105
105
|
| -------------------- | ------------------------------------------------------------------------------------------------------------------------------------ |
|
|
@@ -303,7 +303,17 @@ export class SubmitCheckComponent {
|
|
|
303
303
|
|
|
304
304
|
## Theming / CSS variables
|
|
305
305
|
|
|
306
|
-
No component-specific CSS variables. Style via `class`, `checkboxClass`, `labelClass`,
|
|
306
|
+
No component-specific CSS variables. Style per-instance via `class`, `checkboxClass`, `labelClass`, `errorClass`, `hintClass` inputs. The row layout (`flex items-center gap-1`) is fixed in the template.
|
|
307
|
+
|
|
308
|
+
Global defaults per styling slot via the wrapper config (precedence: library base < global config < per-instance):
|
|
309
|
+
|
|
310
|
+
```ts
|
|
311
|
+
import { provideEgFormCheckboxConfig } from '@egose/shadcn-theme-ng/form-checkbox';
|
|
312
|
+
|
|
313
|
+
await bootstrapApplication(App, {
|
|
314
|
+
providers: [provideEgFormCheckboxConfig({ checkboxClass: 'tw:size-5', labelClass: 'tw:font-medium' })],
|
|
315
|
+
});
|
|
316
|
+
```
|
|
307
317
|
|
|
308
318
|
## Related subpaths
|
|
309
319
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { inject, input, computed, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
2
|
+
import { InjectionToken, inject, input, computed, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
3
3
|
import * as i1 from '@angular/forms';
|
|
4
4
|
import { FormGroupDirective, ReactiveFormsModule, ControlContainer } from '@angular/forms';
|
|
5
5
|
import { HlmLabel } from '@egose/shadcn-theme-ng/label';
|
|
@@ -8,9 +8,18 @@ import { HlmFormIdGenerator, HlmError, HlmHint } from '@egose/shadcn-theme-ng/fo
|
|
|
8
8
|
import { EgFormField } from '@egose/shadcn-theme-ng/form-field-simple';
|
|
9
9
|
import { hlm } from '@egose/shadcn-theme-ng/utils';
|
|
10
10
|
|
|
11
|
+
const EgFormCheckboxConfigToken = new InjectionToken('EgFormCheckboxConfig');
|
|
12
|
+
function provideEgFormCheckboxConfig(config) {
|
|
13
|
+
return { provide: EgFormCheckboxConfigToken, useValue: { ...config } };
|
|
14
|
+
}
|
|
15
|
+
function injectEgFormCheckboxConfig() {
|
|
16
|
+
return inject(EgFormCheckboxConfigToken, { optional: true }) ?? {};
|
|
17
|
+
}
|
|
18
|
+
|
|
11
19
|
class EgFormCheckbox {
|
|
12
20
|
formGroupDirective = inject(FormGroupDirective);
|
|
13
21
|
generatedId = inject(HlmFormIdGenerator).generate('eg-form-checkbox');
|
|
22
|
+
_config = injectEgFormCheckboxConfig();
|
|
14
23
|
// Classes
|
|
15
24
|
userClass = input('', { ...(ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {}), alias: 'class' });
|
|
16
25
|
_computedClass = computed(() => hlm('', this.userClass()), /* @ts-ignore */
|
|
@@ -55,17 +64,21 @@ class EgFormCheckbox {
|
|
|
55
64
|
...(ngDevMode ? [{ debugName: "checkboxClass" }] : /* istanbul ignore next */ []));
|
|
56
65
|
labelClass = input('', /* @ts-ignore */
|
|
57
66
|
...(ngDevMode ? [{ debugName: "labelClass" }] : /* istanbul ignore next */ []));
|
|
58
|
-
|
|
59
|
-
|
|
67
|
+
errorClass = input('', /* @ts-ignore */
|
|
68
|
+
...(ngDevMode ? [{ debugName: "errorClass" }] : /* istanbul ignore next */ []));
|
|
69
|
+
hintClass = input('', /* @ts-ignore */
|
|
70
|
+
...(ngDevMode ? [{ debugName: "hintClass" }] : /* istanbul ignore next */ []));
|
|
71
|
+
// Computed styling (library base < global config < per-instance)
|
|
72
|
+
$checkboxClass = computed(() => hlm(this._config.checkboxClass, this.checkboxClass()), /* @ts-ignore */
|
|
60
73
|
...(ngDevMode ? [{ debugName: "$checkboxClass" }] : /* istanbul ignore next */ []));
|
|
61
|
-
$labelClass = computed(() => hlm(this.labelClass()), /* @ts-ignore */
|
|
74
|
+
$labelClass = computed(() => hlm(this._config.labelClass, this.labelClass()), /* @ts-ignore */
|
|
62
75
|
...(ngDevMode ? [{ debugName: "$labelClass" }] : /* istanbul ignore next */ []));
|
|
63
|
-
$errorClass =
|
|
76
|
+
$errorClass = computed(() => hlm(this._config.errorClass, this.errorClass()), /* @ts-ignore */
|
|
64
77
|
...(ngDevMode ? [{ debugName: "$errorClass" }] : /* istanbul ignore next */ []));
|
|
65
|
-
$hintClass =
|
|
78
|
+
$hintClass = computed(() => hlm(this._config.hintClass, this.hintClass()), /* @ts-ignore */
|
|
66
79
|
...(ngDevMode ? [{ debugName: "$hintClass" }] : /* istanbul ignore next */ []));
|
|
67
80
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: EgFormCheckbox, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
68
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.3", type: EgFormCheckbox, isStandalone: true, selector: "eg-form-checkbox", inputs: { userClass: { classPropertyName: "userClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, 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 }, checked: { classPropertyName: "checked", publicName: "checked", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, checkboxClass: { classPropertyName: "checkboxClass", publicName: "checkboxClass", isSignal: true, isRequired: false, transformFunction: null }, labelClass: { classPropertyName: "labelClass", publicName: "labelClass", isSignal: true, isRequired: false, transformFunction: null },
|
|
81
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.3", type: EgFormCheckbox, isStandalone: true, selector: "eg-form-checkbox", inputs: { userClass: { classPropertyName: "userClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, 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 }, checked: { classPropertyName: "checked", publicName: "checked", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, checkboxClass: { classPropertyName: "checkboxClass", publicName: "checkboxClass", isSignal: true, isRequired: false, transformFunction: null }, labelClass: { classPropertyName: "labelClass", publicName: "labelClass", isSignal: true, isRequired: false, transformFunction: null }, errorClass: { classPropertyName: "errorClass", publicName: "errorClass", isSignal: true, isRequired: false, transformFunction: null }, hintClass: { classPropertyName: "hintClass", publicName: "hintClass", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "_computedClass()" } }, providers: [{ provide: ControlContainer, useExisting: FormGroupDirective }], ngImport: i0, template: "\n @let lbl = label();\n @let cnm = controlName();\n @let err = error();\n @let hnt = hint();\n @let rqrd = required();\n\n <eg-form-field>\n <div class=\"flex items-center gap-1\">\n <hlm-checkbox\n [id]=\"effectiveId()\"\n [name]=\"cnm || name() || null\"\n [formControlName]=\"cnm\"\n [class]=\"$checkboxClass()\"\n [checked]=\"checked()\"\n [required]=\"rqrd\"\n [wrapperDisabled]=\"disabled()\"\n [aria-describedby]=\"describedBy()\"\n />\n <label hlmLabel [for]=\"effectiveId()\" [class]=\"$labelClass()\">\n {{ lbl }}\n @if (rqrd) {\n <span class=\"text-red-500\">*</span>\n }\n </label>\n </div>\n\n @if (err) {\n <hlm-error [id]=\"errorId()\" [class]=\"$errorClass()\">\n {{ err }}\n </hlm-error>\n }\n\n @if (hnt) {\n <hlm-hint [id]=\"hintId()\" [class]=\"$hintClass()\">\n {{ hnt }}\n </hlm-hint>\n }\n </eg-form-field>\n ", isInline: true, dependencies: [{ kind: "ngmodule", type: ReactiveFormsModule }, { 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.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: HlmCheckbox, selector: "hlm-checkbox", inputs: ["class", "id", "aria-label", "aria-labelledby", "aria-describedby", "checked", "name", "required", "disabled", "wrapperDisabled"], outputs: ["checkedChange", "changed"] }, { kind: "directive", type: HlmLabel, selector: "[hlmLabel]", inputs: ["class"] }, { kind: "component", type: EgFormField, selector: "eg-form-field", inputs: ["class"] }, { kind: "directive", type: HlmError, selector: "hlm-error", inputs: ["class"] }, { kind: "directive", type: HlmHint, selector: "hlm-hint", inputs: ["class"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
69
82
|
}
|
|
70
83
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: EgFormCheckbox, decorators: [{
|
|
71
84
|
type: Component,
|
|
@@ -80,7 +93,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImpor
|
|
|
80
93
|
providers: [{ provide: ControlContainer, useExisting: FormGroupDirective }],
|
|
81
94
|
template: "\n @let lbl = label();\n @let cnm = controlName();\n @let err = error();\n @let hnt = hint();\n @let rqrd = required();\n\n <eg-form-field>\n <div class=\"flex items-center gap-1\">\n <hlm-checkbox\n [id]=\"effectiveId()\"\n [name]=\"cnm || name() || null\"\n [formControlName]=\"cnm\"\n [class]=\"$checkboxClass()\"\n [checked]=\"checked()\"\n [required]=\"rqrd\"\n [wrapperDisabled]=\"disabled()\"\n [aria-describedby]=\"describedBy()\"\n />\n <label hlmLabel [for]=\"effectiveId()\" [class]=\"$labelClass()\">\n {{ lbl }}\n @if (rqrd) {\n <span class=\"text-red-500\">*</span>\n }\n </label>\n </div>\n\n @if (err) {\n <hlm-error [id]=\"errorId()\" [class]=\"$errorClass()\">\n {{ err }}\n </hlm-error>\n }\n\n @if (hnt) {\n <hlm-hint [id]=\"hintId()\" [class]=\"$hintClass()\">\n {{ hnt }}\n </hlm-hint>\n }\n </eg-form-field>\n ",
|
|
82
95
|
}]
|
|
83
|
-
}], propDecorators: { userClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], controlId: [{ type: i0.Input, args: [{ isSignal: true, alias: "controlId", required: false }] }], controlName: [{ type: i0.Input, args: [{ isSignal: true, alias: "controlName", required: false }] }], error: [{ type: i0.Input, args: [{ isSignal: true, alias: "error", required: false }] }], hint: [{ type: i0.Input, args: [{ isSignal: true, alias: "hint", required: false }] }], id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], name: [{ type: i0.Input, args: [{ isSignal: true, alias: "name", required: false }] }], checked: [{ type: i0.Input, args: [{ isSignal: true, alias: "checked", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], checkboxClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "checkboxClass", required: false }] }], labelClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "labelClass", required: false }] }],
|
|
96
|
+
}], propDecorators: { userClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], controlId: [{ type: i0.Input, args: [{ isSignal: true, alias: "controlId", required: false }] }], controlName: [{ type: i0.Input, args: [{ isSignal: true, alias: "controlName", required: false }] }], error: [{ type: i0.Input, args: [{ isSignal: true, alias: "error", required: false }] }], hint: [{ type: i0.Input, args: [{ isSignal: true, alias: "hint", required: false }] }], id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], name: [{ type: i0.Input, args: [{ isSignal: true, alias: "name", required: false }] }], checked: [{ type: i0.Input, args: [{ isSignal: true, alias: "checked", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], checkboxClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "checkboxClass", required: false }] }], labelClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "labelClass", required: false }] }], errorClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "errorClass", required: false }] }], hintClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "hintClass", required: false }] }] } });
|
|
84
97
|
|
|
85
98
|
/*
|
|
86
99
|
* Public API Surface of form-checkbox
|
|
@@ -90,5 +103,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImpor
|
|
|
90
103
|
* Generated bundle index. Do not edit.
|
|
91
104
|
*/
|
|
92
105
|
|
|
93
|
-
export { EgFormCheckbox };
|
|
106
|
+
export { EgFormCheckbox, injectEgFormCheckboxConfig, provideEgFormCheckboxConfig };
|
|
94
107
|
|
|
@@ -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 EgFormCheckbox {
|
|
5
6
|
private readonly formGroupDirective;
|
|
6
7
|
private readonly generatedId;
|
|
8
|
+
private readonly _config;
|
|
7
9
|
readonly userClass: _angular_core.InputSignal<ClassValue>;
|
|
8
10
|
protected readonly _computedClass: _angular_core.Signal<string>;
|
|
9
11
|
label: _angular_core.InputSignal<string>;
|
|
@@ -22,12 +24,29 @@ declare class EgFormCheckbox {
|
|
|
22
24
|
describedBy(): string | null;
|
|
23
25
|
checkboxClass: _angular_core.InputSignal<string>;
|
|
24
26
|
labelClass: _angular_core.InputSignal<string>;
|
|
27
|
+
errorClass: _angular_core.InputSignal<string>;
|
|
28
|
+
hintClass: _angular_core.InputSignal<string>;
|
|
25
29
|
$checkboxClass: _angular_core.Signal<string>;
|
|
26
30
|
$labelClass: _angular_core.Signal<string>;
|
|
27
|
-
$errorClass: _angular_core.
|
|
28
|
-
$hintClass: _angular_core.
|
|
31
|
+
$errorClass: _angular_core.Signal<string>;
|
|
32
|
+
$hintClass: _angular_core.Signal<string>;
|
|
29
33
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<EgFormCheckbox, never>;
|
|
30
|
-
static ɵcmp: _angular_core.ɵɵComponentDeclaration<EgFormCheckbox, "eg-form-checkbox", never, { "userClass": { "alias": "class"; "required": false; "isSignal": true; }; "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; }; "checked": { "alias": "checked"; "required": false; "isSignal": true; }; "required": { "alias": "required"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "checkboxClass": { "alias": "checkboxClass"; "required": false; "isSignal": true; }; "labelClass": { "alias": "labelClass"; "required": false; "isSignal": true; }; "
|
|
34
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<EgFormCheckbox, "eg-form-checkbox", never, { "userClass": { "alias": "class"; "required": false; "isSignal": true; }; "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; }; "checked": { "alias": "checked"; "required": false; "isSignal": true; }; "required": { "alias": "required"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "checkboxClass": { "alias": "checkboxClass"; "required": false; "isSignal": true; }; "labelClass": { "alias": "labelClass"; "required": false; "isSignal": true; }; "errorClass": { "alias": "errorClass"; "required": false; "isSignal": true; }; "hintClass": { "alias": "hintClass"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
31
35
|
}
|
|
32
36
|
|
|
33
|
-
|
|
37
|
+
interface EgFormCheckboxConfig {
|
|
38
|
+
/**
|
|
39
|
+
* Global class defaults for `eg-form-checkbox` styling slots.
|
|
40
|
+
* Each is merged under the matching per-instance `*Class` input
|
|
41
|
+
* (library base < global config < per-instance).
|
|
42
|
+
*/
|
|
43
|
+
checkboxClass?: string;
|
|
44
|
+
labelClass?: string;
|
|
45
|
+
errorClass?: string;
|
|
46
|
+
hintClass?: string;
|
|
47
|
+
}
|
|
48
|
+
declare function provideEgFormCheckboxConfig(config: Partial<EgFormCheckboxConfig>): ValueProvider;
|
|
49
|
+
declare function injectEgFormCheckboxConfig(): EgFormCheckboxConfig;
|
|
50
|
+
|
|
51
|
+
export { EgFormCheckbox, injectEgFormCheckboxConfig, provideEgFormCheckboxConfig };
|
|
52
|
+
export type { EgFormCheckboxConfig };
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
# Form Combobox (`@egose/shadcn-theme-ng/form-combobox`)
|
|
2
|
+
|
|
3
|
+
A ready-made reactive-form combobox: label + searchable dropdown + validation error/hint display in one tag. Supports `multiple` mode (chips anchor, `string[]` model, the default) and `single` mode (trigger button, `string | null` model).
|
|
4
|
+
|
|
5
|
+
The Angular implementation is a standalone wrapper: it renders `HlmFormField` / `HlmError` / `HlmHint` from `@egose/shadcn-theme-ng/form-field`, `HlmLabel`, and the `HlmCombobox*` parts from `@egose/shadcn-theme-ng/combobox` (`HlmComboboxMultiple` + chips for multi, `HlmCombobox` + trigger for single). The picker root is bound with `[formControlName]="controlName()"` (both brain variants implement `ControlValueAccessor`), so the parent `FormGroup` owns the value. It must live inside a `FormGroupDirective` (`[formGroup]` parent); ids come from `HlmFormIdGenerator` unless overridden.
|
|
6
|
+
|
|
7
|
+
> **Ships as:** `@egose/shadcn-theme-ng/form-combobox` and `@egose/shadcn-theme-ng-tw/form-combobox`
|
|
8
|
+
> (the `tw:`-prefixed Tailwind variant). Both expose the identical TypeScript surface; only the
|
|
9
|
+
> emitted Tailwind class strings differ. See the [package README](../../README.md) for install
|
|
10
|
+
> steps, peer dependencies, and Tailwind setup. Do not publish this project directory independently.
|
|
11
|
+
|
|
12
|
+
## Installation
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
# Plain Tailwind (no prefix)
|
|
16
|
+
npm install @egose/shadcn-theme-ng
|
|
17
|
+
|
|
18
|
+
# tw:-prefixed Tailwind variant
|
|
19
|
+
npm install @egose/shadcn-theme-ng-tw
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Peer dependencies (Angular, `@spartan-ng/brain`, `@ng-icons/*`, `rxjs`, …) are documented in the
|
|
23
|
+
[package README](../../README.md#peer-dependencies). This subpath additionally relies at runtime on
|
|
24
|
+
`@egose/shadcn-theme-ng/combobox`, `@egose/shadcn-theme-ng/form-field`, and
|
|
25
|
+
`@egose/shadcn-theme-ng/label`.
|
|
26
|
+
|
|
27
|
+
## Imports
|
|
28
|
+
|
|
29
|
+
Exported from the subpath root (`projects/form-combobox/src/public-api.ts`):
|
|
30
|
+
|
|
31
|
+
```ts
|
|
32
|
+
import { EgFormCombobox, provideEgFormComboboxConfig } from '@egose/shadcn-theme-ng/form-combobox';
|
|
33
|
+
// tw variant: replace with '@egose/shadcn-theme-ng-tw/form-combobox'
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Anatomy / Structure
|
|
37
|
+
|
|
38
|
+
```html
|
|
39
|
+
<form [formGroup]="form">
|
|
40
|
+
<eg-form-combobox controlName="tags" label="Tags" [options]="tags" [required]="true" error="Pick at least one." />
|
|
41
|
+
</form>
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Selector (from source): `eg-form-combobox` (standalone component, host `tw:w-full`).
|
|
45
|
+
|
|
46
|
+
## API reference
|
|
47
|
+
|
|
48
|
+
### `EgFormCombobox` — `eg-form-combobox`
|
|
49
|
+
|
|
50
|
+
| Input | Type | Default | Description |
|
|
51
|
+
| -------------- | ------------------------ | ------------------------ | ----------------------------------------------------------------------------------------------------------- |
|
|
52
|
+
| `controlName` | `string` | `''` | `formControlName` key inside the parent `FormGroup`. **Required.** |
|
|
53
|
+
| `mode` | `'single' \| 'multiple'` | `'multiple'` | `multiple` renders chips + multi-select (`string[]`); `single` renders a trigger button (`string \| null`). |
|
|
54
|
+
| `label` | `string \| undefined` | — | Label text (hidden when omitted). |
|
|
55
|
+
| `error` | `string \| undefined` | — | Error text shown when invalid. |
|
|
56
|
+
| `hint` | `string \| undefined` | — | Hint text shown otherwise. |
|
|
57
|
+
| `controlId` | `string \| undefined` | — | Explicit id (first priority for `effectiveId`). |
|
|
58
|
+
| `id` | `string \| undefined` | — | Fallback id (second priority). |
|
|
59
|
+
| `placeholder` | `string` | `'Pick…'` | Search input placeholder. |
|
|
60
|
+
| `emptyText` | `string` | `'Nothing left to add.'` | Text shown when no option matches. |
|
|
61
|
+
| `disabled` | `boolean` | `false` | Locks interaction (form control stays enabled). |
|
|
62
|
+
| `required` | `boolean` | `false` | Shows a red `*` next to the label. |
|
|
63
|
+
| `options` | `string[]` | `[]` | Rendered as `hlm-combobox-item` entries. |
|
|
64
|
+
| `class` | `ClassValue` | `''` | Extra host classes (base `tw:w-full`). |
|
|
65
|
+
| `labelClass` | `string` | `''` | Extra label classes (base `tw:mb-1`). |
|
|
66
|
+
| `controlClass` | `string` | `''` | Extra multi-root classes. |
|
|
67
|
+
| `chipsClass` | `string` | `''` | Extra chips-anchor classes. |
|
|
68
|
+
| `errorClass` | `string` | `''` | Extra error classes (base `tw:mt-0`). |
|
|
69
|
+
| `hintClass` | `string` | `''` | Extra hint classes (base `tw:mt-0`). |
|
|
70
|
+
|
|
71
|
+
| Member | Description |
|
|
72
|
+
| -------------------- | ---------------------------------------------------------------------------------- |
|
|
73
|
+
| `effectiveId` | `controlId() \|\| id() \|\| generated` — wired to chip-input `id` and label `for`. |
|
|
74
|
+
| `errorId` / `hintId` | `effectiveId + '-error' / '-hint'`. |
|
|
75
|
+
| `selectedValues` | Current selection read reactively from the brain model — drives chip rendering. |
|
|
76
|
+
|
|
77
|
+
Requires a `[formGroup]` ancestor (injects `FormGroupDirective`, provides `ControlContainer → FormGroupDirective`).
|
|
78
|
+
|
|
79
|
+
## Examples
|
|
80
|
+
|
|
81
|
+
### 1. Required multi-select
|
|
82
|
+
|
|
83
|
+
```ts
|
|
84
|
+
import { Component, inject } from '@angular/core';
|
|
85
|
+
import { FormBuilder, ReactiveFormsModule, Validators } from '@angular/forms';
|
|
86
|
+
import { EgFormCombobox } from '@egose/shadcn-theme-ng/form-combobox';
|
|
87
|
+
|
|
88
|
+
@Component({
|
|
89
|
+
selector: 'app-tags',
|
|
90
|
+
standalone: true,
|
|
91
|
+
imports: [ReactiveFormsModule, EgFormCombobox],
|
|
92
|
+
template: `
|
|
93
|
+
<form [formGroup]="form" (ngSubmit)="submit()">
|
|
94
|
+
<eg-form-combobox controlName="tags" label="Tags" [options]="tags" [required]="true" error="Pick at least one." />
|
|
95
|
+
<button type="submit" [disabled]="form.invalid">Save</button>
|
|
96
|
+
</form>
|
|
97
|
+
`,
|
|
98
|
+
})
|
|
99
|
+
export class TagsComponent {
|
|
100
|
+
private readonly fb = inject(FormBuilder);
|
|
101
|
+
readonly form = this.fb.group({ tags: [<string[]>[], Validators.required] });
|
|
102
|
+
readonly tags = ['Angular', 'React', 'Vue', 'Svelte'];
|
|
103
|
+
submit() {
|
|
104
|
+
console.log(this.form.value.tags);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### 2. Preselected with hint
|
|
110
|
+
|
|
111
|
+
```ts
|
|
112
|
+
import { Component, inject } from '@angular/core';
|
|
113
|
+
import { FormBuilder, ReactiveFormsModule } from '@angular/forms';
|
|
114
|
+
import { EgFormCombobox } from '@egose/shadcn-theme-ng/form-combobox';
|
|
115
|
+
|
|
116
|
+
@Component({
|
|
117
|
+
selector: 'app-stack',
|
|
118
|
+
standalone: true,
|
|
119
|
+
imports: [ReactiveFormsModule, EgFormCombobox],
|
|
120
|
+
template: `
|
|
121
|
+
<form [formGroup]="form">
|
|
122
|
+
<eg-form-combobox
|
|
123
|
+
controlName="stack"
|
|
124
|
+
label="Stack"
|
|
125
|
+
[options]="options"
|
|
126
|
+
placeholder="Add tag…"
|
|
127
|
+
hint="Type to filter, click to add, × to remove."
|
|
128
|
+
/>
|
|
129
|
+
</form>
|
|
130
|
+
`,
|
|
131
|
+
})
|
|
132
|
+
export class StackComponent {
|
|
133
|
+
private readonly fb = inject(FormBuilder);
|
|
134
|
+
readonly form = this.fb.group({ stack: [['Angular']] });
|
|
135
|
+
readonly options = ['Angular', 'React', 'Vue', 'Svelte', 'Solid'];
|
|
136
|
+
}
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### 3. Single-select dropdown
|
|
140
|
+
|
|
141
|
+
```ts
|
|
142
|
+
import { Component, inject } from '@angular/core';
|
|
143
|
+
import { FormBuilder, ReactiveFormsModule, Validators } from '@angular/forms';
|
|
144
|
+
import { EgFormCombobox } from '@egose/shadcn-theme-ng/form-combobox';
|
|
145
|
+
|
|
146
|
+
@Component({
|
|
147
|
+
selector: 'app-fruit-single',
|
|
148
|
+
standalone: true,
|
|
149
|
+
imports: [ReactiveFormsModule, EgFormCombobox],
|
|
150
|
+
template: `
|
|
151
|
+
<form [formGroup]="form" (ngSubmit)="submit()">
|
|
152
|
+
<eg-form-combobox
|
|
153
|
+
controlName="fruit"
|
|
154
|
+
label="Fruit"
|
|
155
|
+
mode="single"
|
|
156
|
+
[options]="options"
|
|
157
|
+
placeholder="Select a fruit…"
|
|
158
|
+
[required]="true"
|
|
159
|
+
error="Fruit is required."
|
|
160
|
+
/>
|
|
161
|
+
<button type="submit" [disabled]="form.invalid">Save</button>
|
|
162
|
+
</form>
|
|
163
|
+
`,
|
|
164
|
+
})
|
|
165
|
+
export class FruitSingleComponent {
|
|
166
|
+
private readonly fb = inject(FormBuilder);
|
|
167
|
+
readonly form = this.fb.group({ fruit: [null as string | null, Validators.required] });
|
|
168
|
+
readonly options = ['Apple', 'Banana', 'Cherry'];
|
|
169
|
+
submit() {
|
|
170
|
+
console.log(this.form.value.fruit);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
## Accessibility notes
|
|
176
|
+
|
|
177
|
+
- Label `for` ↔ chip-search-input `id` wiring is automatic via `effectiveId` — always pass a `label`.
|
|
178
|
+
- The chip search input exposes no `aria-describedby`, so error/hint ids render without an input-level link.
|
|
179
|
+
- The required `*` is visual; pair with `Validators.required` so assistive tech and validation agree.
|
|
180
|
+
|
|
181
|
+
## Theming / CSS variables
|
|
182
|
+
|
|
183
|
+
No component-specific CSS variables. Style per-instance via `class` / `labelClass` / `controlClass` / `chipsClass` / `errorClass` / `hintClass` (precedence: library base < global config < per-instance).
|
|
184
|
+
|
|
185
|
+
Global defaults per styling slot via the wrapper config:
|
|
186
|
+
|
|
187
|
+
```ts
|
|
188
|
+
import { provideEgFormComboboxConfig } from '@egose/shadcn-theme-ng/form-combobox';
|
|
189
|
+
|
|
190
|
+
await bootstrapApplication(App, {
|
|
191
|
+
providers: [provideEgFormComboboxConfig({ labelClass: 'tw:font-medium' })],
|
|
192
|
+
});
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
The host keeps `tw:w-full`; constrain width with `class` or a wrapping container.
|
|
196
|
+
|
|
197
|
+
## Related subpaths
|
|
198
|
+
|
|
199
|
+
- `@egose/shadcn-theme-ng/combobox` — raw `HlmCombobox*` parts (single + multi) for custom layouts.
|
|
200
|
+
- `@egose/shadcn-theme-ng/form-autocomplete` — single-value text-search counterpart (`eg-form-autocomplete`).
|
|
201
|
+
- `@egose/shadcn-theme-ng/form-searchable-multiselect` — alternative multi-select with popover checkboxes.
|
|
202
|
+
- `@egose/shadcn-theme-ng/form-field` — `hlm-form-field` / `hlm-error` / `hlm-hint` used internally.
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { InjectionToken, inject, viewChild, input, computed, Component } from '@angular/core';
|
|
3
|
+
import * as i1 from '@angular/forms';
|
|
4
|
+
import { FormGroupDirective, ReactiveFormsModule, ControlContainer } from '@angular/forms';
|
|
5
|
+
import { HlmFormIdGenerator, HlmFormField, HlmError, HlmHint } from '@egose/shadcn-theme-ng/form-field';
|
|
6
|
+
import { HlmLabel } from '@egose/shadcn-theme-ng/label';
|
|
7
|
+
import { HlmCombobox, HlmComboboxChip, HlmComboboxChipInput, HlmComboboxChips, HlmComboboxContent, HlmComboboxEmpty, HlmComboboxInput, HlmComboboxItem, HlmComboboxList, HlmComboboxMultiple, HlmComboboxPortal, HlmComboboxTrigger } from '@egose/shadcn-theme-ng/combobox';
|
|
8
|
+
import { BrnComboboxMultiple, BrnCombobox } from '@spartan-ng/brain/combobox';
|
|
9
|
+
import { hlm } from '@egose/shadcn-theme-ng/utils';
|
|
10
|
+
|
|
11
|
+
const EgFormComboboxConfigToken = new InjectionToken('EgFormComboboxConfig');
|
|
12
|
+
function provideEgFormComboboxConfig(config) {
|
|
13
|
+
return { provide: EgFormComboboxConfigToken, useValue: { ...config } };
|
|
14
|
+
}
|
|
15
|
+
function injectEgFormComboboxConfig() {
|
|
16
|
+
return inject(EgFormComboboxConfigToken, { optional: true }) ?? {};
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
class EgFormCombobox {
|
|
20
|
+
formGroupDirective = inject(FormGroupDirective);
|
|
21
|
+
generatedId = inject(HlmFormIdGenerator).generate('eg-form-combobox');
|
|
22
|
+
_config = injectEgFormComboboxConfig();
|
|
23
|
+
_picker = viewChild((BrnComboboxMultiple), /* @ts-ignore */
|
|
24
|
+
...(ngDevMode ? [{ debugName: "_picker" }] : /* istanbul ignore next */ []));
|
|
25
|
+
_single = viewChild((BrnCombobox), /* @ts-ignore */
|
|
26
|
+
...(ngDevMode ? [{ debugName: "_single" }] : /* istanbul ignore next */ []));
|
|
27
|
+
label = input(undefined, /* @ts-ignore */
|
|
28
|
+
...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
29
|
+
controlId = input(undefined, /* @ts-ignore */
|
|
30
|
+
...(ngDevMode ? [{ debugName: "controlId" }] : /* istanbul ignore next */ []));
|
|
31
|
+
controlName = input('', /* @ts-ignore */
|
|
32
|
+
...(ngDevMode ? [{ debugName: "controlName" }] : /* istanbul ignore next */ []));
|
|
33
|
+
error = input(undefined, /* @ts-ignore */
|
|
34
|
+
...(ngDevMode ? [{ debugName: "error" }] : /* istanbul ignore next */ []));
|
|
35
|
+
hint = input(undefined, /* @ts-ignore */
|
|
36
|
+
...(ngDevMode ? [{ debugName: "hint" }] : /* istanbul ignore next */ []));
|
|
37
|
+
id = input(undefined, /* @ts-ignore */
|
|
38
|
+
...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
|
|
39
|
+
placeholder = input('Pick…', /* @ts-ignore */
|
|
40
|
+
...(ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []));
|
|
41
|
+
emptyText = input('Nothing left to add.', /* @ts-ignore */
|
|
42
|
+
...(ngDevMode ? [{ debugName: "emptyText" }] : /* istanbul ignore next */ []));
|
|
43
|
+
disabled = input(false, /* @ts-ignore */
|
|
44
|
+
...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
45
|
+
required = input(false, /* @ts-ignore */
|
|
46
|
+
...(ngDevMode ? [{ debugName: "required" }] : /* istanbul ignore next */ []));
|
|
47
|
+
/**
|
|
48
|
+
* Selection mode. `multiple` renders chips + checkbox-style multi-select
|
|
49
|
+
* (`string[]` model); `single` renders a trigger button + dropdown
|
|
50
|
+
* (`string | null` model). Defaults to `multiple` (original behavior).
|
|
51
|
+
*/
|
|
52
|
+
mode = input('multiple', /* @ts-ignore */
|
|
53
|
+
...(ngDevMode ? [{ debugName: "mode" }] : /* istanbul ignore next */ []));
|
|
54
|
+
options = input([], /* @ts-ignore */
|
|
55
|
+
...(ngDevMode ? [{ debugName: "options" }] : /* istanbul ignore next */ []));
|
|
56
|
+
effectiveId = computed(() => this.controlId() || this.id() || this.generatedId, /* @ts-ignore */
|
|
57
|
+
...(ngDevMode ? [{ debugName: "effectiveId" }] : /* istanbul ignore next */ []));
|
|
58
|
+
errorId = computed(() => `${this.effectiveId()}-error`, /* @ts-ignore */
|
|
59
|
+
...(ngDevMode ? [{ debugName: "errorId" }] : /* istanbul ignore next */ []));
|
|
60
|
+
hintId = computed(() => `${this.effectiveId()}-hint`, /* @ts-ignore */
|
|
61
|
+
...(ngDevMode ? [{ debugName: "hintId" }] : /* istanbul ignore next */ []));
|
|
62
|
+
/** Selected values read reactively from the brain model so chips track selection. */
|
|
63
|
+
selectedValues = computed(() => this._picker()?.value() ?? [], /* @ts-ignore */
|
|
64
|
+
...(ngDevMode ? [{ debugName: "selectedValues" }] : /* istanbul ignore next */ []));
|
|
65
|
+
/** Single-mode display value read reactively from the brain model. */
|
|
66
|
+
singleDisplay = computed(() => this._single()?.value() ?? null, /* @ts-ignore */
|
|
67
|
+
...(ngDevMode ? [{ debugName: "singleDisplay" }] : /* istanbul ignore next */ []));
|
|
68
|
+
/**
|
|
69
|
+
* Combined lock for the brain `linkedSignal`-based disabled state: the raw
|
|
70
|
+
* input write always carries the resolved value, so a same-pass
|
|
71
|
+
* wrapper-toggle + `control.disable()` cannot clobber CVA state.
|
|
72
|
+
*/
|
|
73
|
+
effectiveDisabled() {
|
|
74
|
+
return this.disabled() || !!this.formGroupDirective.form.get(this.controlName())?.disabled;
|
|
75
|
+
}
|
|
76
|
+
// Styling
|
|
77
|
+
userClass = input('', { ...(ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {}), alias: 'class' });
|
|
78
|
+
labelClass = input('', /* @ts-ignore */
|
|
79
|
+
...(ngDevMode ? [{ debugName: "labelClass" }] : /* istanbul ignore next */ []));
|
|
80
|
+
controlClass = input('', /* @ts-ignore */
|
|
81
|
+
...(ngDevMode ? [{ debugName: "controlClass" }] : /* istanbul ignore next */ []));
|
|
82
|
+
chipsClass = input('', /* @ts-ignore */
|
|
83
|
+
...(ngDevMode ? [{ debugName: "chipsClass" }] : /* istanbul ignore next */ []));
|
|
84
|
+
errorClass = input('', /* @ts-ignore */
|
|
85
|
+
...(ngDevMode ? [{ debugName: "errorClass" }] : /* istanbul ignore next */ []));
|
|
86
|
+
hintClass = input('', /* @ts-ignore */
|
|
87
|
+
...(ngDevMode ? [{ debugName: "hintClass" }] : /* istanbul ignore next */ []));
|
|
88
|
+
// Computed classes (library base < global config < per-instance).
|
|
89
|
+
// NOTE: the chip search input exposes no aria-describedby, so error/hint
|
|
90
|
+
// ids render without an input-level describedby link.
|
|
91
|
+
$userClass = computed(() => hlm("w-full", this.userClass()), /* @ts-ignore */
|
|
92
|
+
...(ngDevMode ? [{ debugName: "$userClass" }] : /* istanbul ignore next */ []));
|
|
93
|
+
$labelClass = computed(() => hlm("mb-1", this._config.labelClass, this.labelClass()), /* @ts-ignore */
|
|
94
|
+
...(ngDevMode ? [{ debugName: "$labelClass" }] : /* istanbul ignore next */ []));
|
|
95
|
+
$controlClass = computed(() => hlm(this._config.controlClass, this.controlClass()), /* @ts-ignore */
|
|
96
|
+
...(ngDevMode ? [{ debugName: "$controlClass" }] : /* istanbul ignore next */ []));
|
|
97
|
+
$chipsClass = computed(() => hlm(this._config.chipsClass, this.chipsClass()), /* @ts-ignore */
|
|
98
|
+
...(ngDevMode ? [{ debugName: "$chipsClass" }] : /* istanbul ignore next */ []));
|
|
99
|
+
$errorClass = computed(() => hlm("mt-0", this._config.errorClass, this.errorClass()), /* @ts-ignore */
|
|
100
|
+
...(ngDevMode ? [{ debugName: "$errorClass" }] : /* istanbul ignore next */ []));
|
|
101
|
+
$hintClass = computed(() => hlm("mt-0", this._config.hintClass, this.hintClass()), /* @ts-ignore */
|
|
102
|
+
...(ngDevMode ? [{ debugName: "$hintClass" }] : /* istanbul ignore next */ []));
|
|
103
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: EgFormCombobox, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
104
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.3", type: EgFormCombobox, isStandalone: true, selector: "eg-form-combobox", 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 }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, emptyText: { classPropertyName: "emptyText", publicName: "emptyText", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, mode: { classPropertyName: "mode", publicName: "mode", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", 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 }, controlClass: { classPropertyName: "controlClass", publicName: "controlClass", isSignal: true, isRequired: false, transformFunction: null }, chipsClass: { classPropertyName: "chipsClass", publicName: "chipsClass", 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 }], viewQueries: [{ propertyName: "_picker", first: true, predicate: (BrnComboboxMultiple), descendants: true, isSignal: true }, { propertyName: "_single", first: true, predicate: (BrnCombobox), descendants: true, isSignal: true }], ngImport: i0, template: "\n @let lbl = label();\n @let cnm = controlName();\n @let err = error();\n @let hnt = hint();\n @let rqrd = required();\n\n <hlm-form-field>\n @if (lbl) {\n <label hlmLabel [for]=\"effectiveId()\" [class]=\"$labelClass()\"\n >{{ lbl }}\n @if (rqrd) {\n <span class=\"text-red-500\">*</span>\n }\n </label>\n }\n\n @if (mode() === 'single') {\n <hlm-combobox [formControlName]=\"cnm\" [disabled]=\"effectiveDisabled()\">\n <hlm-combobox-trigger [buttonId]=\"effectiveId()\" [class]=\"$controlClass()\">\n {{ singleDisplay() ?? placeholder() }}\n </hlm-combobox-trigger>\n <hlm-combobox-content *hlmComboboxPortal>\n <hlm-combobox-input [inputId]=\"effectiveId()\" [placeholder]=\"placeholder()\" />\n <div hlmComboboxList>\n @for (option of options(); track option) {\n <hlm-combobox-item [value]=\"option\">{{ option }}</hlm-combobox-item>\n }\n </div>\n <div hlmComboboxEmpty>{{ emptyText() }}</div>\n </hlm-combobox-content>\n </hlm-combobox>\n } @else {\n <hlm-combobox-multiple [formControlName]=\"cnm\" [disabled]=\"effectiveDisabled()\" [class]=\"$controlClass()\">\n <hlm-combobox-chips [class]=\"$chipsClass()\">\n @for (v of selectedValues(); track v) {\n <hlm-combobox-chip [value]=\"v\">{{ v }}</hlm-combobox-chip>\n }\n <input hlmComboboxChipInput [id]=\"effectiveId()\" [placeholder]=\"placeholder()\" />\n </hlm-combobox-chips>\n <hlm-combobox-content *hlmComboboxPortal>\n <div hlmComboboxList>\n @for (option of options(); track option) {\n <hlm-combobox-item [value]=\"option\">{{ option }}</hlm-combobox-item>\n }\n </div>\n <div hlmComboboxEmpty>{{ emptyText() }}</div>\n </hlm-combobox-content>\n </hlm-combobox-multiple>\n }\n\n @if (err) {\n <hlm-error [id]=\"errorId()\" [class]=\"$errorClass()\">\n {{ err }}\n </hlm-error>\n }\n\n @if (hnt) {\n <hlm-hint [id]=\"hintId()\" [class]=\"$hintClass()\">\n {{ hnt }}\n </hlm-hint>\n }\n </hlm-form-field>\n ", isInline: true, dependencies: [{ kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { 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: HlmCombobox, selector: "[hlmCombobox],hlm-combobox" }, { kind: "component", type: HlmComboboxChip, selector: "hlm-combobox-chip", inputs: ["showRemove"] }, { kind: "directive", type: HlmComboboxChipInput, selector: "input[hlmComboboxChipInput]" }, { kind: "directive", type: HlmComboboxChips, selector: "[hlmComboboxChips],hlm-combobox-chips", inputs: ["forceInvalid"] }, { kind: "directive", type: HlmComboboxContent, selector: "[hlmComboboxContent],hlm-combobox-content" }, { kind: "directive", type: HlmComboboxEmpty, selector: "[hlmComboboxEmpty],hlm-combobox-empty" }, { kind: "component", type: HlmComboboxInput, selector: "hlm-combobox-input", inputs: ["inputId", "placeholder", "showTrigger", "showClear", "forceInvalid", "aria-invalid"] }, { kind: "component", type: HlmComboboxItem, selector: "hlm-combobox-item" }, { kind: "directive", type: HlmComboboxList, selector: "[hlmComboboxList]" }, { kind: "directive", type: HlmComboboxMultiple, selector: "[hlmComboboxMultiple],hlm-combobox-multiple" }, { kind: "directive", type: HlmComboboxPortal, selector: "[hlmComboboxPortal]" }, { kind: "component", type: HlmComboboxTrigger, selector: "hlm-combobox-trigger", inputs: ["class", "buttonId", "variant", "forceInvalid"] }] });
|
|
105
|
+
}
|
|
106
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: EgFormCombobox, decorators: [{
|
|
107
|
+
type: Component,
|
|
108
|
+
args: [{
|
|
109
|
+
selector: 'eg-form-combobox',
|
|
110
|
+
standalone: true,
|
|
111
|
+
host: {
|
|
112
|
+
'[class]': '$userClass()',
|
|
113
|
+
},
|
|
114
|
+
imports: [
|
|
115
|
+
ReactiveFormsModule,
|
|
116
|
+
HlmFormField,
|
|
117
|
+
HlmError,
|
|
118
|
+
HlmHint,
|
|
119
|
+
HlmLabel,
|
|
120
|
+
HlmCombobox,
|
|
121
|
+
HlmComboboxChip,
|
|
122
|
+
HlmComboboxChipInput,
|
|
123
|
+
HlmComboboxChips,
|
|
124
|
+
HlmComboboxContent,
|
|
125
|
+
HlmComboboxEmpty,
|
|
126
|
+
HlmComboboxInput,
|
|
127
|
+
HlmComboboxItem,
|
|
128
|
+
HlmComboboxList,
|
|
129
|
+
HlmComboboxMultiple,
|
|
130
|
+
HlmComboboxPortal,
|
|
131
|
+
HlmComboboxTrigger,
|
|
132
|
+
],
|
|
133
|
+
providers: [{ provide: ControlContainer, useExisting: FormGroupDirective }],
|
|
134
|
+
template: "\n @let lbl = label();\n @let cnm = controlName();\n @let err = error();\n @let hnt = hint();\n @let rqrd = required();\n\n <hlm-form-field>\n @if (lbl) {\n <label hlmLabel [for]=\"effectiveId()\" [class]=\"$labelClass()\"\n >{{ lbl }}\n @if (rqrd) {\n <span class=\"text-red-500\">*</span>\n }\n </label>\n }\n\n @if (mode() === 'single') {\n <hlm-combobox [formControlName]=\"cnm\" [disabled]=\"effectiveDisabled()\">\n <hlm-combobox-trigger [buttonId]=\"effectiveId()\" [class]=\"$controlClass()\">\n {{ singleDisplay() ?? placeholder() }}\n </hlm-combobox-trigger>\n <hlm-combobox-content *hlmComboboxPortal>\n <hlm-combobox-input [inputId]=\"effectiveId()\" [placeholder]=\"placeholder()\" />\n <div hlmComboboxList>\n @for (option of options(); track option) {\n <hlm-combobox-item [value]=\"option\">{{ option }}</hlm-combobox-item>\n }\n </div>\n <div hlmComboboxEmpty>{{ emptyText() }}</div>\n </hlm-combobox-content>\n </hlm-combobox>\n } @else {\n <hlm-combobox-multiple [formControlName]=\"cnm\" [disabled]=\"effectiveDisabled()\" [class]=\"$controlClass()\">\n <hlm-combobox-chips [class]=\"$chipsClass()\">\n @for (v of selectedValues(); track v) {\n <hlm-combobox-chip [value]=\"v\">{{ v }}</hlm-combobox-chip>\n }\n <input hlmComboboxChipInput [id]=\"effectiveId()\" [placeholder]=\"placeholder()\" />\n </hlm-combobox-chips>\n <hlm-combobox-content *hlmComboboxPortal>\n <div hlmComboboxList>\n @for (option of options(); track option) {\n <hlm-combobox-item [value]=\"option\">{{ option }}</hlm-combobox-item>\n }\n </div>\n <div hlmComboboxEmpty>{{ emptyText() }}</div>\n </hlm-combobox-content>\n </hlm-combobox-multiple>\n }\n\n @if (err) {\n <hlm-error [id]=\"errorId()\" [class]=\"$errorClass()\">\n {{ err }}\n </hlm-error>\n }\n\n @if (hnt) {\n <hlm-hint [id]=\"hintId()\" [class]=\"$hintClass()\">\n {{ hnt }}\n </hlm-hint>\n }\n </hlm-form-field>\n ",
|
|
135
|
+
}]
|
|
136
|
+
}], propDecorators: { _picker: [{ type: i0.ViewChild, args: [i0.forwardRef(() => BrnComboboxMultiple), { isSignal: true }] }], _single: [{ type: i0.ViewChild, args: [i0.forwardRef(() => BrnCombobox), { isSignal: true }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], controlId: [{ type: i0.Input, args: [{ isSignal: true, alias: "controlId", required: false }] }], controlName: [{ type: i0.Input, args: [{ isSignal: true, alias: "controlName", required: false }] }], error: [{ type: i0.Input, args: [{ isSignal: true, alias: "error", required: false }] }], hint: [{ type: i0.Input, args: [{ isSignal: true, alias: "hint", required: false }] }], id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], emptyText: [{ type: i0.Input, args: [{ isSignal: true, alias: "emptyText", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }], mode: [{ type: i0.Input, args: [{ isSignal: true, alias: "mode", required: false }] }], options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }], userClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], labelClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "labelClass", required: false }] }], controlClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "controlClass", required: false }] }], chipsClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "chipsClass", required: false }] }], errorClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "errorClass", required: false }] }], hintClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "hintClass", required: false }] }] } });
|
|
137
|
+
|
|
138
|
+
/*
|
|
139
|
+
* Public API Surface of form-combobox
|
|
140
|
+
*/
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Generated bundle index. Do not edit.
|
|
144
|
+
*/
|
|
145
|
+
|
|
146
|
+
export { EgFormCombobox, injectEgFormComboboxConfig, provideEgFormComboboxConfig };
|
|
147
|
+
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "form-combobox",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"peerDependencies": {
|
|
5
|
+
"@angular/common": "^20.3.0 || ^22.0.0",
|
|
6
|
+
"@angular/core": "^20.3.0 || ^22.0.0"
|
|
7
|
+
},
|
|
8
|
+
"dependencies": {
|
|
9
|
+
"tslib": "^2.3.0"
|
|
10
|
+
},
|
|
11
|
+
"sideEffects": false,
|
|
12
|
+
"module": "fesm2022/form-combobox.mjs",
|
|
13
|
+
"typings": "types/form-combobox.d.ts",
|
|
14
|
+
"exports": {
|
|
15
|
+
"./package.json": {
|
|
16
|
+
"default": "./package.json"
|
|
17
|
+
},
|
|
18
|
+
".": {
|
|
19
|
+
"types": "./types/form-combobox.d.ts",
|
|
20
|
+
"default": "./fesm2022/form-combobox.mjs"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"type": "module"
|
|
24
|
+
}
|