@egose/shadcn-theme-ng-tw 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/alert/fesm2022/alert.mjs +1 -1
- package/autocomplete/fesm2022/autocomplete.mjs +1 -1
- package/button/fesm2022/button.mjs +3 -3
- 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 +211 -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 +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 +48 -22
- 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-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 +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 +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 +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 +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/input-group/fesm2022/input-group.mjs +20 -10
- 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/sheet/fesm2022/sheet.mjs +1 -1
- package/switch/fesm2022/switch.mjs +7 -5
- package/switch/types/switch.d.ts +2 -1
|
@@ -0,0 +1,273 @@
|
|
|
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-tw/form-field';
|
|
6
|
+
import { HlmLabel } from '@egose/shadcn-theme-ng-tw/label';
|
|
7
|
+
import { HlmCombobox, HlmComboboxChip, HlmComboboxChipInput, HlmComboboxChips, HlmComboboxContent, HlmComboboxEmpty, HlmComboboxInput, HlmComboboxItem, HlmComboboxList, HlmComboboxMultiple, HlmComboboxPortal, HlmComboboxTrigger } from '@egose/shadcn-theme-ng-tw/combobox';
|
|
8
|
+
import { BrnComboboxMultiple, BrnCombobox } from '@spartan-ng/brain/combobox';
|
|
9
|
+
import { hlm } from '@egose/shadcn-theme-ng-tw/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('tw:w-full', this.userClass()), /* @ts-ignore */
|
|
92
|
+
...(ngDevMode ? [{ debugName: "$userClass" }] : /* istanbul ignore next */ []));
|
|
93
|
+
$labelClass = computed(() => hlm('tw: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('tw:mt-0', this._config.errorClass, this.errorClass()), /* @ts-ignore */
|
|
100
|
+
...(ngDevMode ? [{ debugName: "$errorClass" }] : /* istanbul ignore next */ []));
|
|
101
|
+
$hintClass = computed(() => hlm('tw: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: `
|
|
105
|
+
@let lbl = label();
|
|
106
|
+
@let cnm = controlName();
|
|
107
|
+
@let err = error();
|
|
108
|
+
@let hnt = hint();
|
|
109
|
+
@let rqrd = required();
|
|
110
|
+
|
|
111
|
+
<hlm-form-field>
|
|
112
|
+
@if (lbl) {
|
|
113
|
+
<label hlmLabel [for]="effectiveId()" [class]="$labelClass()"
|
|
114
|
+
>{{ lbl }}
|
|
115
|
+
@if (rqrd) {
|
|
116
|
+
<span class="tw:text-red-500">*</span>
|
|
117
|
+
}
|
|
118
|
+
</label>
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
@if (mode() === 'single') {
|
|
122
|
+
<hlm-combobox [formControlName]="cnm" [disabled]="effectiveDisabled()">
|
|
123
|
+
<hlm-combobox-trigger [buttonId]="effectiveId()" [class]="$controlClass()">
|
|
124
|
+
{{ singleDisplay() ?? placeholder() }}
|
|
125
|
+
</hlm-combobox-trigger>
|
|
126
|
+
<hlm-combobox-content *hlmComboboxPortal>
|
|
127
|
+
<hlm-combobox-input [inputId]="effectiveId()" [placeholder]="placeholder()" />
|
|
128
|
+
<div hlmComboboxList>
|
|
129
|
+
@for (option of options(); track option) {
|
|
130
|
+
<hlm-combobox-item [value]="option">{{ option }}</hlm-combobox-item>
|
|
131
|
+
}
|
|
132
|
+
</div>
|
|
133
|
+
<div hlmComboboxEmpty>{{ emptyText() }}</div>
|
|
134
|
+
</hlm-combobox-content>
|
|
135
|
+
</hlm-combobox>
|
|
136
|
+
} @else {
|
|
137
|
+
<hlm-combobox-multiple [formControlName]="cnm" [disabled]="effectiveDisabled()" [class]="$controlClass()">
|
|
138
|
+
<hlm-combobox-chips [class]="$chipsClass()">
|
|
139
|
+
@for (v of selectedValues(); track v) {
|
|
140
|
+
<hlm-combobox-chip [value]="v">{{ v }}</hlm-combobox-chip>
|
|
141
|
+
}
|
|
142
|
+
<input hlmComboboxChipInput [id]="effectiveId()" [placeholder]="placeholder()" />
|
|
143
|
+
</hlm-combobox-chips>
|
|
144
|
+
<hlm-combobox-content *hlmComboboxPortal>
|
|
145
|
+
<div hlmComboboxList>
|
|
146
|
+
@for (option of options(); track option) {
|
|
147
|
+
<hlm-combobox-item [value]="option">{{ option }}</hlm-combobox-item>
|
|
148
|
+
}
|
|
149
|
+
</div>
|
|
150
|
+
<div hlmComboboxEmpty>{{ emptyText() }}</div>
|
|
151
|
+
</hlm-combobox-content>
|
|
152
|
+
</hlm-combobox-multiple>
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
@if (err) {
|
|
156
|
+
<hlm-error [id]="errorId()" [class]="$errorClass()">
|
|
157
|
+
{{ err }}
|
|
158
|
+
</hlm-error>
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
@if (hnt) {
|
|
162
|
+
<hlm-hint [id]="hintId()" [class]="$hintClass()">
|
|
163
|
+
{{ hnt }}
|
|
164
|
+
</hlm-hint>
|
|
165
|
+
}
|
|
166
|
+
</hlm-form-field>
|
|
167
|
+
`, 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"] }] });
|
|
168
|
+
}
|
|
169
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: EgFormCombobox, decorators: [{
|
|
170
|
+
type: Component,
|
|
171
|
+
args: [{
|
|
172
|
+
selector: 'eg-form-combobox',
|
|
173
|
+
standalone: true,
|
|
174
|
+
host: {
|
|
175
|
+
'[class]': '$userClass()',
|
|
176
|
+
},
|
|
177
|
+
imports: [
|
|
178
|
+
ReactiveFormsModule,
|
|
179
|
+
HlmFormField,
|
|
180
|
+
HlmError,
|
|
181
|
+
HlmHint,
|
|
182
|
+
HlmLabel,
|
|
183
|
+
HlmCombobox,
|
|
184
|
+
HlmComboboxChip,
|
|
185
|
+
HlmComboboxChipInput,
|
|
186
|
+
HlmComboboxChips,
|
|
187
|
+
HlmComboboxContent,
|
|
188
|
+
HlmComboboxEmpty,
|
|
189
|
+
HlmComboboxInput,
|
|
190
|
+
HlmComboboxItem,
|
|
191
|
+
HlmComboboxList,
|
|
192
|
+
HlmComboboxMultiple,
|
|
193
|
+
HlmComboboxPortal,
|
|
194
|
+
HlmComboboxTrigger,
|
|
195
|
+
],
|
|
196
|
+
providers: [{ provide: ControlContainer, useExisting: FormGroupDirective }],
|
|
197
|
+
template: `
|
|
198
|
+
@let lbl = label();
|
|
199
|
+
@let cnm = controlName();
|
|
200
|
+
@let err = error();
|
|
201
|
+
@let hnt = hint();
|
|
202
|
+
@let rqrd = required();
|
|
203
|
+
|
|
204
|
+
<hlm-form-field>
|
|
205
|
+
@if (lbl) {
|
|
206
|
+
<label hlmLabel [for]="effectiveId()" [class]="$labelClass()"
|
|
207
|
+
>{{ lbl }}
|
|
208
|
+
@if (rqrd) {
|
|
209
|
+
<span class="tw:text-red-500">*</span>
|
|
210
|
+
}
|
|
211
|
+
</label>
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
@if (mode() === 'single') {
|
|
215
|
+
<hlm-combobox [formControlName]="cnm" [disabled]="effectiveDisabled()">
|
|
216
|
+
<hlm-combobox-trigger [buttonId]="effectiveId()" [class]="$controlClass()">
|
|
217
|
+
{{ singleDisplay() ?? placeholder() }}
|
|
218
|
+
</hlm-combobox-trigger>
|
|
219
|
+
<hlm-combobox-content *hlmComboboxPortal>
|
|
220
|
+
<hlm-combobox-input [inputId]="effectiveId()" [placeholder]="placeholder()" />
|
|
221
|
+
<div hlmComboboxList>
|
|
222
|
+
@for (option of options(); track option) {
|
|
223
|
+
<hlm-combobox-item [value]="option">{{ option }}</hlm-combobox-item>
|
|
224
|
+
}
|
|
225
|
+
</div>
|
|
226
|
+
<div hlmComboboxEmpty>{{ emptyText() }}</div>
|
|
227
|
+
</hlm-combobox-content>
|
|
228
|
+
</hlm-combobox>
|
|
229
|
+
} @else {
|
|
230
|
+
<hlm-combobox-multiple [formControlName]="cnm" [disabled]="effectiveDisabled()" [class]="$controlClass()">
|
|
231
|
+
<hlm-combobox-chips [class]="$chipsClass()">
|
|
232
|
+
@for (v of selectedValues(); track v) {
|
|
233
|
+
<hlm-combobox-chip [value]="v">{{ v }}</hlm-combobox-chip>
|
|
234
|
+
}
|
|
235
|
+
<input hlmComboboxChipInput [id]="effectiveId()" [placeholder]="placeholder()" />
|
|
236
|
+
</hlm-combobox-chips>
|
|
237
|
+
<hlm-combobox-content *hlmComboboxPortal>
|
|
238
|
+
<div hlmComboboxList>
|
|
239
|
+
@for (option of options(); track option) {
|
|
240
|
+
<hlm-combobox-item [value]="option">{{ option }}</hlm-combobox-item>
|
|
241
|
+
}
|
|
242
|
+
</div>
|
|
243
|
+
<div hlmComboboxEmpty>{{ emptyText() }}</div>
|
|
244
|
+
</hlm-combobox-content>
|
|
245
|
+
</hlm-combobox-multiple>
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
@if (err) {
|
|
249
|
+
<hlm-error [id]="errorId()" [class]="$errorClass()">
|
|
250
|
+
{{ err }}
|
|
251
|
+
</hlm-error>
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
@if (hnt) {
|
|
255
|
+
<hlm-hint [id]="hintId()" [class]="$hintClass()">
|
|
256
|
+
{{ hnt }}
|
|
257
|
+
</hlm-hint>
|
|
258
|
+
}
|
|
259
|
+
</hlm-form-field>
|
|
260
|
+
`,
|
|
261
|
+
}]
|
|
262
|
+
}], 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 }] }] } });
|
|
263
|
+
|
|
264
|
+
/*
|
|
265
|
+
* Public API Surface of form-combobox
|
|
266
|
+
*/
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* Generated bundle index. Do not edit.
|
|
270
|
+
*/
|
|
271
|
+
|
|
272
|
+
export { EgFormCombobox, injectEgFormComboboxConfig, provideEgFormComboboxConfig };
|
|
273
|
+
|
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import * as _angular_core from '@angular/core';
|
|
2
|
+
import { ValueProvider } from '@angular/core';
|
|
3
|
+
import { ClassValue } from 'clsx';
|
|
4
|
+
|
|
5
|
+
declare class EgFormCombobox {
|
|
6
|
+
private readonly formGroupDirective;
|
|
7
|
+
private readonly generatedId;
|
|
8
|
+
private readonly _config;
|
|
9
|
+
private readonly _picker;
|
|
10
|
+
private readonly _single;
|
|
11
|
+
label: _angular_core.InputSignal<string | undefined>;
|
|
12
|
+
controlId: _angular_core.InputSignal<string | undefined>;
|
|
13
|
+
controlName: _angular_core.InputSignal<string>;
|
|
14
|
+
error: _angular_core.InputSignal<string | undefined>;
|
|
15
|
+
hint: _angular_core.InputSignal<string | undefined>;
|
|
16
|
+
id: _angular_core.InputSignal<string | undefined>;
|
|
17
|
+
placeholder: _angular_core.InputSignal<string>;
|
|
18
|
+
emptyText: _angular_core.InputSignal<string>;
|
|
19
|
+
disabled: _angular_core.InputSignal<boolean>;
|
|
20
|
+
required: _angular_core.InputSignal<boolean>;
|
|
21
|
+
/**
|
|
22
|
+
* Selection mode. `multiple` renders chips + checkbox-style multi-select
|
|
23
|
+
* (`string[]` model); `single` renders a trigger button + dropdown
|
|
24
|
+
* (`string | null` model). Defaults to `multiple` (original behavior).
|
|
25
|
+
*/
|
|
26
|
+
mode: _angular_core.InputSignal<"single" | "multiple">;
|
|
27
|
+
options: _angular_core.InputSignal<string[]>;
|
|
28
|
+
readonly effectiveId: _angular_core.Signal<string>;
|
|
29
|
+
readonly errorId: _angular_core.Signal<string>;
|
|
30
|
+
readonly hintId: _angular_core.Signal<string>;
|
|
31
|
+
/** Selected values read reactively from the brain model so chips track selection. */
|
|
32
|
+
readonly selectedValues: _angular_core.Signal<string[]>;
|
|
33
|
+
/** Single-mode display value read reactively from the brain model. */
|
|
34
|
+
readonly singleDisplay: _angular_core.Signal<string | null>;
|
|
35
|
+
/**
|
|
36
|
+
* Combined lock for the brain `linkedSignal`-based disabled state: the raw
|
|
37
|
+
* input write always carries the resolved value, so a same-pass
|
|
38
|
+
* wrapper-toggle + `control.disable()` cannot clobber CVA state.
|
|
39
|
+
*/
|
|
40
|
+
effectiveDisabled(): boolean;
|
|
41
|
+
userClass: _angular_core.InputSignal<ClassValue>;
|
|
42
|
+
labelClass: _angular_core.InputSignal<string>;
|
|
43
|
+
controlClass: _angular_core.InputSignal<string>;
|
|
44
|
+
chipsClass: _angular_core.InputSignal<string>;
|
|
45
|
+
errorClass: _angular_core.InputSignal<string>;
|
|
46
|
+
hintClass: _angular_core.InputSignal<string>;
|
|
47
|
+
$userClass: _angular_core.Signal<string>;
|
|
48
|
+
$labelClass: _angular_core.Signal<string>;
|
|
49
|
+
$controlClass: _angular_core.Signal<string>;
|
|
50
|
+
$chipsClass: _angular_core.Signal<string>;
|
|
51
|
+
$errorClass: _angular_core.Signal<string>;
|
|
52
|
+
$hintClass: _angular_core.Signal<string>;
|
|
53
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<EgFormCombobox, never>;
|
|
54
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<EgFormCombobox, "eg-form-combobox", 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; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "emptyText": { "alias": "emptyText"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "required": { "alias": "required"; "required": false; "isSignal": true; }; "mode": { "alias": "mode"; "required": false; "isSignal": true; }; "options": { "alias": "options"; "required": false; "isSignal": true; }; "userClass": { "alias": "class"; "required": false; "isSignal": true; }; "labelClass": { "alias": "labelClass"; "required": false; "isSignal": true; }; "controlClass": { "alias": "controlClass"; "required": false; "isSignal": true; }; "chipsClass": { "alias": "chipsClass"; "required": false; "isSignal": true; }; "errorClass": { "alias": "errorClass"; "required": false; "isSignal": true; }; "hintClass": { "alias": "hintClass"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
interface EgFormComboboxConfig {
|
|
58
|
+
/**
|
|
59
|
+
* Global class defaults for `eg-form-combobox` styling slots.
|
|
60
|
+
* Each is merged under the matching per-instance `*Class` input
|
|
61
|
+
* (library base < global config < per-instance).
|
|
62
|
+
*/
|
|
63
|
+
labelClass?: string;
|
|
64
|
+
controlClass?: string;
|
|
65
|
+
chipsClass?: string;
|
|
66
|
+
errorClass?: string;
|
|
67
|
+
hintClass?: string;
|
|
68
|
+
}
|
|
69
|
+
declare function provideEgFormComboboxConfig(config: Partial<EgFormComboboxConfig>): ValueProvider;
|
|
70
|
+
declare function injectEgFormComboboxConfig(): EgFormComboboxConfig;
|
|
71
|
+
|
|
72
|
+
export { EgFormCombobox, injectEgFormComboboxConfig, provideEgFormComboboxConfig };
|
|
73
|
+
export type { EgFormComboboxConfig };
|
|
@@ -84,27 +84,33 @@ Selector (from source): `eg-form-date-picker` (standalone component, host `tw:w-
|
|
|
84
84
|
|
|
85
85
|
### `EgFormDatePicker` — `eg-form-date-picker`
|
|
86
86
|
|
|
87
|
-
| Input | Type
|
|
88
|
-
| ------------------- |
|
|
89
|
-
| `controlName` | `string`
|
|
90
|
-
| `label` | `string \| undefined`
|
|
91
|
-
| `error` | `string \| undefined`
|
|
92
|
-
| `hint` | `string \| undefined`
|
|
93
|
-
| `controlId` | `string \| undefined`
|
|
94
|
-
| `id` | `string \| undefined`
|
|
95
|
-
| `name` | `string \| undefined`
|
|
96
|
-
| `placeholder` | `string`
|
|
97
|
-
| `readonly` | `boolean`
|
|
98
|
-
| `disabled` | `boolean`
|
|
99
|
-
| `required` | `boolean`
|
|
100
|
-
| `min` | `Date \| string \| null`
|
|
101
|
-
| `max` | `Date \| string \| null`
|
|
102
|
-
| `autoCloseOnSelect` | `boolean`
|
|
103
|
-
| `
|
|
104
|
-
| `
|
|
105
|
-
| `
|
|
106
|
-
| `
|
|
107
|
-
| `
|
|
87
|
+
| Input | Type | Default | Description |
|
|
88
|
+
| ------------------- | --------------------------------- | --------------- | ------------------------------------------------------------------------------------------------------------- |
|
|
89
|
+
| `controlName` | `string` | `''` | `formControlName` key inside the parent `FormGroup`. **Required.** |
|
|
90
|
+
| `label` | `string \| undefined` | — | Label text (hidden when omitted). |
|
|
91
|
+
| `error` | `string \| undefined` | — | Error text shown when invalid. |
|
|
92
|
+
| `hint` | `string \| undefined` | — | Hint text shown otherwise. |
|
|
93
|
+
| `controlId` | `string \| undefined` | — | Explicit id (first priority for `effectiveId`). |
|
|
94
|
+
| `id` | `string \| undefined` | — | Fallback id (second priority). |
|
|
95
|
+
| `name` | `string \| undefined` | — | Native `name` forwarded to the inner input (`controlName` wins when set, like `eg-form-text-input`). |
|
|
96
|
+
| `placeholder` | `string` | `'Pick a date'` | Input placeholder. |
|
|
97
|
+
| `readonly` | `boolean` | `false` | Native `readonly` forwarded to the inner input (locks typed text; use `disabled` to lock the calendar too). |
|
|
98
|
+
| `disabled` | `boolean` | `false` | Locks interaction via picker `wrapperDisabled` (form control stays enabled). |
|
|
99
|
+
| `required` | `boolean` | `false` | Shows a red `*` next to the label. |
|
|
100
|
+
| `min` | `Date \| string \| null` | `null` | Minimum date forwarded to `hlm-date-picker`. |
|
|
101
|
+
| `max` | `Date \| string \| null` | `null` | Maximum date forwarded to `hlm-date-picker`. |
|
|
102
|
+
| `autoCloseOnSelect` | `boolean` | config default | Forwarded to `hlm-date-picker` (falls back to `provideHlmDatePickerConfig`, default `false`). |
|
|
103
|
+
| `captionLayout` | union | `'label'` | Forwarded to `hlm-date-picker` (`'dropdown' \| 'label' \| 'dropdown-months' \| 'dropdown-years'`). |
|
|
104
|
+
| `formatDate` | `(date: Date) => string` | config default | Display format, forwarded to `hlm-date-picker` (falls back to `provideHlmDatePickerConfig`). |
|
|
105
|
+
| `transformDate` | `(date: Date) => Date` | config default | Model transform, forwarded to `hlm-date-picker` (falls back to `provideHlmDatePickerConfig`). |
|
|
106
|
+
| `parseDate` | `(value: string) => Date \| null` | config default | Input parsing, forwarded to `hlm-date-picker-input` (falls back to `provideHlmDatePickerConfig`). |
|
|
107
|
+
| `formatInputDate` | `(date: Date) => string` | config default | Edit format while focused, forwarded to `hlm-date-picker-input` (falls back to `provideHlmDatePickerConfig`). |
|
|
108
|
+
| `class` | `ClassValue` | `''` | Extra host classes (base `tw:w-full`). |
|
|
109
|
+
| `labelClass` | `string` | `''` | Extra label classes (base `tw:mb-1`). |
|
|
110
|
+
| `pickerClass` | `string` | `''` | Extra picker-container classes (base `tw:mb-1`). |
|
|
111
|
+
| `inputClass` | `string` | `''` | Extra inner-input classes (e.g. `tw:text-lg` for text size). |
|
|
112
|
+
| `errorClass` | `string` | `''` | Extra error classes (base `tw:mt-0`). |
|
|
113
|
+
| `hintClass` | `string` | `''` | Extra hint classes (base `tw:mt-0`). |
|
|
108
114
|
|
|
109
115
|
| Member | Description |
|
|
110
116
|
| -------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
@@ -293,6 +299,7 @@ import { EgFormDatePicker } from '@egose/shadcn-theme-ng/form-date-picker';
|
|
|
293
299
|
label="Event date"
|
|
294
300
|
labelClass="tw:font-semibold"
|
|
295
301
|
pickerClass="tw:max-w-xs"
|
|
302
|
+
inputClass="tw:text-lg"
|
|
296
303
|
hint="Doors open one hour earlier."
|
|
297
304
|
/>
|
|
298
305
|
</form>
|
|
@@ -313,7 +320,26 @@ export class StyledDateComponent {
|
|
|
313
320
|
|
|
314
321
|
## Theming / CSS variables
|
|
315
322
|
|
|
316
|
-
No component-specific CSS variables. Style via `labelClass` / `pickerClass` / `errorClass` / `hintClass`
|
|
323
|
+
No component-specific CSS variables. Style per-instance via `class` / `labelClass` / `pickerClass` / `inputClass` / `errorClass` / `hintClass` (precedence: library base < global config < per-instance).
|
|
324
|
+
|
|
325
|
+
Global defaults (styling analogue of `formatDate`) via the picker config:
|
|
326
|
+
|
|
327
|
+
```ts
|
|
328
|
+
import { provideHlmDatePickerConfig } from '@egose/shadcn-theme-ng/date-picker';
|
|
329
|
+
|
|
330
|
+
await bootstrapApplication(App, {
|
|
331
|
+
providers: [
|
|
332
|
+
provideHlmDatePickerConfig({
|
|
333
|
+
inputClass: 'tw:text-sm', // every date input; per-instance inputClass still wins on conflict
|
|
334
|
+
labelClass: 'tw:font-medium',
|
|
335
|
+
}),
|
|
336
|
+
],
|
|
337
|
+
});
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
The same `labelClass` / `pickerClass` / `inputClass` / `errorClass` / `hintClass` keys exist on
|
|
341
|
+
`HlmDateRangePickerConfig`, `HlmDatePickerMultiConfig`, and `HlmMonthYearPickerConfig` for future
|
|
342
|
+
wrappers. The host keeps `tw:w-full`; constrain width with `class` (e.g. `tw:max-w-xs`) or a wrapping container.
|
|
317
343
|
|
|
318
344
|
## Related subpaths
|
|
319
345
|
|