@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,211 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { InjectionToken, inject, 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 { HlmRadioGroup, HlmRadio, HlmRadioIndicator } from '@egose/shadcn-theme-ng-tw/radio-group';
|
|
8
|
+
import { hlm } from '@egose/shadcn-theme-ng-tw/utils';
|
|
9
|
+
|
|
10
|
+
const EgFormRadioGroupConfigToken = new InjectionToken('EgFormRadioGroupConfig');
|
|
11
|
+
function provideEgFormRadioGroupConfig(config) {
|
|
12
|
+
return { provide: EgFormRadioGroupConfigToken, useValue: { ...config } };
|
|
13
|
+
}
|
|
14
|
+
function injectEgFormRadioGroupConfig() {
|
|
15
|
+
return inject(EgFormRadioGroupConfigToken, { optional: true }) ?? {};
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
class EgFormRadioGroup {
|
|
19
|
+
formGroupDirective = inject(FormGroupDirective);
|
|
20
|
+
generatedId = inject(HlmFormIdGenerator).generate('eg-form-radio-group');
|
|
21
|
+
_config = injectEgFormRadioGroupConfig();
|
|
22
|
+
label = input(undefined, /* @ts-ignore */
|
|
23
|
+
...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
24
|
+
controlId = input(undefined, /* @ts-ignore */
|
|
25
|
+
...(ngDevMode ? [{ debugName: "controlId" }] : /* istanbul ignore next */ []));
|
|
26
|
+
controlName = input('', /* @ts-ignore */
|
|
27
|
+
...(ngDevMode ? [{ debugName: "controlName" }] : /* istanbul ignore next */ []));
|
|
28
|
+
error = input(undefined, /* @ts-ignore */
|
|
29
|
+
...(ngDevMode ? [{ debugName: "error" }] : /* istanbul ignore next */ []));
|
|
30
|
+
hint = input(undefined, /* @ts-ignore */
|
|
31
|
+
...(ngDevMode ? [{ debugName: "hint" }] : /* istanbul ignore next */ []));
|
|
32
|
+
id = input(undefined, /* @ts-ignore */
|
|
33
|
+
...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
|
|
34
|
+
name = input(undefined, /* @ts-ignore */
|
|
35
|
+
...(ngDevMode ? [{ debugName: "name" }] : /* istanbul ignore next */ []));
|
|
36
|
+
disabled = input(false, /* @ts-ignore */
|
|
37
|
+
...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
38
|
+
required = input(false, /* @ts-ignore */
|
|
39
|
+
...(ngDevMode ? [{ debugName: "required" }] : /* istanbul ignore next */ []));
|
|
40
|
+
options = input([], /* @ts-ignore */
|
|
41
|
+
...(ngDevMode ? [{ debugName: "options" }] : /* istanbul ignore next */ []));
|
|
42
|
+
effectiveId = computed(() => this.controlId() || this.id() || this.generatedId, /* @ts-ignore */
|
|
43
|
+
...(ngDevMode ? [{ debugName: "effectiveId" }] : /* istanbul ignore next */ []));
|
|
44
|
+
errorId = computed(() => `${this.effectiveId()}-error`, /* @ts-ignore */
|
|
45
|
+
...(ngDevMode ? [{ debugName: "errorId" }] : /* istanbul ignore next */ []));
|
|
46
|
+
hintId = computed(() => `${this.effectiveId()}-hint`, /* @ts-ignore */
|
|
47
|
+
...(ngDevMode ? [{ debugName: "hintId" }] : /* istanbul ignore next */ []));
|
|
48
|
+
/**
|
|
49
|
+
* Combined lock for the brain `linkedSignal`-based disabled state: the raw
|
|
50
|
+
* input write always carries the resolved value, so a same-pass
|
|
51
|
+
* wrapper-toggle + `control.disable()` cannot clobber CVA state.
|
|
52
|
+
*/
|
|
53
|
+
effectiveDisabled() {
|
|
54
|
+
return this.disabled() || !!this.formGroupDirective.form.get(this.controlName())?.disabled;
|
|
55
|
+
}
|
|
56
|
+
describedBy() {
|
|
57
|
+
const control = this.formGroupDirective.form.get(this.controlName());
|
|
58
|
+
return this.error() && control?.invalid && (control.dirty || control.touched)
|
|
59
|
+
? this.errorId()
|
|
60
|
+
: this.hint()
|
|
61
|
+
? this.hintId()
|
|
62
|
+
: null;
|
|
63
|
+
}
|
|
64
|
+
// Styling
|
|
65
|
+
userClass = input('', { ...(ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {}), alias: 'class' });
|
|
66
|
+
labelClass = input('', /* @ts-ignore */
|
|
67
|
+
...(ngDevMode ? [{ debugName: "labelClass" }] : /* istanbul ignore next */ []));
|
|
68
|
+
groupClass = input('', /* @ts-ignore */
|
|
69
|
+
...(ngDevMode ? [{ debugName: "groupClass" }] : /* istanbul ignore next */ []));
|
|
70
|
+
errorClass = input('', /* @ts-ignore */
|
|
71
|
+
...(ngDevMode ? [{ debugName: "errorClass" }] : /* istanbul ignore next */ []));
|
|
72
|
+
hintClass = input('', /* @ts-ignore */
|
|
73
|
+
...(ngDevMode ? [{ debugName: "hintClass" }] : /* istanbul ignore next */ []));
|
|
74
|
+
// Computed classes (library base < global config < per-instance)
|
|
75
|
+
$userClass = computed(() => hlm('tw:w-full', this.userClass()), /* @ts-ignore */
|
|
76
|
+
...(ngDevMode ? [{ debugName: "$userClass" }] : /* istanbul ignore next */ []));
|
|
77
|
+
$labelClass = computed(() => hlm('tw:mb-1', this._config.labelClass, this.labelClass()), /* @ts-ignore */
|
|
78
|
+
...(ngDevMode ? [{ debugName: "$labelClass" }] : /* istanbul ignore next */ []));
|
|
79
|
+
$groupClass = computed(() => hlm('tw:flex tw:flex-col tw:gap-2', this._config.groupClass, this.groupClass()), /* @ts-ignore */
|
|
80
|
+
...(ngDevMode ? [{ debugName: "$groupClass" }] : /* istanbul ignore next */ []));
|
|
81
|
+
$errorClass = computed(() => hlm('tw:mt-0', this._config.errorClass, this.errorClass()), /* @ts-ignore */
|
|
82
|
+
...(ngDevMode ? [{ debugName: "$errorClass" }] : /* istanbul ignore next */ []));
|
|
83
|
+
$hintClass = computed(() => hlm('tw:mt-0', this._config.hintClass, this.hintClass()), /* @ts-ignore */
|
|
84
|
+
...(ngDevMode ? [{ debugName: "$hintClass" }] : /* istanbul ignore next */ []));
|
|
85
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: EgFormRadioGroup, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
86
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.3", type: EgFormRadioGroup, isStandalone: true, selector: "eg-form-radio-group", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, controlId: { classPropertyName: "controlId", publicName: "controlId", isSignal: true, isRequired: false, transformFunction: null }, controlName: { classPropertyName: "controlName", publicName: "controlName", isSignal: true, isRequired: false, transformFunction: null }, error: { classPropertyName: "error", publicName: "error", isSignal: true, isRequired: false, transformFunction: null }, hint: { classPropertyName: "hint", publicName: "hint", isSignal: true, isRequired: false, transformFunction: null }, id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", 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 }, groupClass: { classPropertyName: "groupClass", publicName: "groupClass", isSignal: true, isRequired: false, transformFunction: null }, errorClass: { classPropertyName: "errorClass", publicName: "errorClass", isSignal: true, isRequired: false, transformFunction: null }, hintClass: { classPropertyName: "hintClass", publicName: "hintClass", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "$userClass()" } }, providers: [{ provide: ControlContainer, useExisting: FormGroupDirective }], ngImport: i0, template: `
|
|
87
|
+
@let lbl = label();
|
|
88
|
+
@let cnm = controlName();
|
|
89
|
+
@let err = error();
|
|
90
|
+
@let hnt = hint();
|
|
91
|
+
@let rqrd = required();
|
|
92
|
+
|
|
93
|
+
<hlm-form-field>
|
|
94
|
+
@if (lbl) {
|
|
95
|
+
<span hlmLabel [class]="$labelClass()"
|
|
96
|
+
>{{ lbl }}
|
|
97
|
+
@if (rqrd) {
|
|
98
|
+
<span class="tw:text-red-500">*</span>
|
|
99
|
+
}
|
|
100
|
+
</span>
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
<hlm-radio-group
|
|
104
|
+
[formControlName]="cnm"
|
|
105
|
+
[name]="cnm || name() || ''"
|
|
106
|
+
[disabled]="effectiveDisabled()"
|
|
107
|
+
[required]="rqrd"
|
|
108
|
+
[class]="$groupClass()"
|
|
109
|
+
>
|
|
110
|
+
@for (option of options(); track option.value) {
|
|
111
|
+
<label class="tw:flex tw:items-center tw:gap-2">
|
|
112
|
+
<hlm-radio
|
|
113
|
+
[value]="option.value"
|
|
114
|
+
[disabled]="option.disabled ?? false"
|
|
115
|
+
[aria-describedby]="describedBy() ?? undefined"
|
|
116
|
+
>
|
|
117
|
+
<hlm-radio-indicator />
|
|
118
|
+
</hlm-radio>
|
|
119
|
+
<span>{{ option.label }}</span>
|
|
120
|
+
</label>
|
|
121
|
+
}
|
|
122
|
+
</hlm-radio-group>
|
|
123
|
+
|
|
124
|
+
@if (err) {
|
|
125
|
+
<hlm-error [id]="errorId()" [class]="$errorClass()">
|
|
126
|
+
{{ err }}
|
|
127
|
+
</hlm-error>
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
@if (hnt) {
|
|
131
|
+
<hlm-hint [id]="hintId()" [class]="$hintClass()">
|
|
132
|
+
{{ hnt }}
|
|
133
|
+
</hlm-hint>
|
|
134
|
+
}
|
|
135
|
+
</hlm-form-field>
|
|
136
|
+
`, 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: 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: HlmRadioGroup, selector: "[hlmRadioGroup],hlm-radio-group", inputs: ["class"] }, { kind: "component", type: HlmRadio, selector: "hlm-radio", inputs: ["class", "inputId", "aria-label", "aria-labelledby", "aria-describedby", "value", "required", "disabled"], outputs: ["change"] }, { kind: "component", type: HlmRadioIndicator, selector: "hlm-radio-indicator" }] });
|
|
137
|
+
}
|
|
138
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: EgFormRadioGroup, decorators: [{
|
|
139
|
+
type: Component,
|
|
140
|
+
args: [{
|
|
141
|
+
selector: 'eg-form-radio-group',
|
|
142
|
+
standalone: true,
|
|
143
|
+
host: {
|
|
144
|
+
'[class]': '$userClass()',
|
|
145
|
+
},
|
|
146
|
+
imports: [ReactiveFormsModule, HlmFormField, HlmError, HlmHint, HlmLabel, HlmRadioGroup, HlmRadio, HlmRadioIndicator],
|
|
147
|
+
providers: [{ provide: ControlContainer, useExisting: FormGroupDirective }],
|
|
148
|
+
template: `
|
|
149
|
+
@let lbl = label();
|
|
150
|
+
@let cnm = controlName();
|
|
151
|
+
@let err = error();
|
|
152
|
+
@let hnt = hint();
|
|
153
|
+
@let rqrd = required();
|
|
154
|
+
|
|
155
|
+
<hlm-form-field>
|
|
156
|
+
@if (lbl) {
|
|
157
|
+
<span hlmLabel [class]="$labelClass()"
|
|
158
|
+
>{{ lbl }}
|
|
159
|
+
@if (rqrd) {
|
|
160
|
+
<span class="tw:text-red-500">*</span>
|
|
161
|
+
}
|
|
162
|
+
</span>
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
<hlm-radio-group
|
|
166
|
+
[formControlName]="cnm"
|
|
167
|
+
[name]="cnm || name() || ''"
|
|
168
|
+
[disabled]="effectiveDisabled()"
|
|
169
|
+
[required]="rqrd"
|
|
170
|
+
[class]="$groupClass()"
|
|
171
|
+
>
|
|
172
|
+
@for (option of options(); track option.value) {
|
|
173
|
+
<label class="tw:flex tw:items-center tw:gap-2">
|
|
174
|
+
<hlm-radio
|
|
175
|
+
[value]="option.value"
|
|
176
|
+
[disabled]="option.disabled ?? false"
|
|
177
|
+
[aria-describedby]="describedBy() ?? undefined"
|
|
178
|
+
>
|
|
179
|
+
<hlm-radio-indicator />
|
|
180
|
+
</hlm-radio>
|
|
181
|
+
<span>{{ option.label }}</span>
|
|
182
|
+
</label>
|
|
183
|
+
}
|
|
184
|
+
</hlm-radio-group>
|
|
185
|
+
|
|
186
|
+
@if (err) {
|
|
187
|
+
<hlm-error [id]="errorId()" [class]="$errorClass()">
|
|
188
|
+
{{ err }}
|
|
189
|
+
</hlm-error>
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
@if (hnt) {
|
|
193
|
+
<hlm-hint [id]="hintId()" [class]="$hintClass()">
|
|
194
|
+
{{ hnt }}
|
|
195
|
+
</hlm-hint>
|
|
196
|
+
}
|
|
197
|
+
</hlm-form-field>
|
|
198
|
+
`,
|
|
199
|
+
}]
|
|
200
|
+
}], propDecorators: { label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], controlId: [{ type: i0.Input, args: [{ isSignal: true, alias: "controlId", required: false }] }], controlName: [{ type: i0.Input, args: [{ isSignal: true, alias: "controlName", required: false }] }], error: [{ type: i0.Input, args: [{ isSignal: true, alias: "error", required: false }] }], hint: [{ type: i0.Input, args: [{ isSignal: true, alias: "hint", required: false }] }], id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], name: [{ type: i0.Input, args: [{ isSignal: true, alias: "name", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", 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 }] }], groupClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "groupClass", required: false }] }], errorClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "errorClass", required: false }] }], hintClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "hintClass", required: false }] }] } });
|
|
201
|
+
|
|
202
|
+
/*
|
|
203
|
+
* Public API Surface of form-radio-group
|
|
204
|
+
*/
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* Generated bundle index. Do not edit.
|
|
208
|
+
*/
|
|
209
|
+
|
|
210
|
+
export { EgFormRadioGroup, injectEgFormRadioGroupConfig, provideEgFormRadioGroupConfig };
|
|
211
|
+
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "form-radio-group",
|
|
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-radio-group.mjs",
|
|
13
|
+
"typings": "types/form-radio-group.d.ts",
|
|
14
|
+
"exports": {
|
|
15
|
+
"./package.json": {
|
|
16
|
+
"default": "./package.json"
|
|
17
|
+
},
|
|
18
|
+
".": {
|
|
19
|
+
"types": "./types/form-radio-group.d.ts",
|
|
20
|
+
"default": "./fesm2022/form-radio-group.mjs"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"type": "module"
|
|
24
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import * as _angular_core from '@angular/core';
|
|
2
|
+
import { ValueProvider } from '@angular/core';
|
|
3
|
+
import { ClassValue } from 'clsx';
|
|
4
|
+
|
|
5
|
+
interface RadioOption {
|
|
6
|
+
value: string;
|
|
7
|
+
label: string;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
}
|
|
10
|
+
declare class EgFormRadioGroup {
|
|
11
|
+
private readonly formGroupDirective;
|
|
12
|
+
private readonly generatedId;
|
|
13
|
+
private readonly _config;
|
|
14
|
+
label: _angular_core.InputSignal<string | undefined>;
|
|
15
|
+
controlId: _angular_core.InputSignal<string | undefined>;
|
|
16
|
+
controlName: _angular_core.InputSignal<string>;
|
|
17
|
+
error: _angular_core.InputSignal<string | undefined>;
|
|
18
|
+
hint: _angular_core.InputSignal<string | undefined>;
|
|
19
|
+
id: _angular_core.InputSignal<string | undefined>;
|
|
20
|
+
name: _angular_core.InputSignal<string | undefined>;
|
|
21
|
+
disabled: _angular_core.InputSignal<boolean>;
|
|
22
|
+
required: _angular_core.InputSignal<boolean>;
|
|
23
|
+
options: _angular_core.InputSignal<RadioOption[]>;
|
|
24
|
+
readonly effectiveId: _angular_core.Signal<string>;
|
|
25
|
+
readonly errorId: _angular_core.Signal<string>;
|
|
26
|
+
readonly hintId: _angular_core.Signal<string>;
|
|
27
|
+
/**
|
|
28
|
+
* Combined lock for the brain `linkedSignal`-based disabled state: the raw
|
|
29
|
+
* input write always carries the resolved value, so a same-pass
|
|
30
|
+
* wrapper-toggle + `control.disable()` cannot clobber CVA state.
|
|
31
|
+
*/
|
|
32
|
+
effectiveDisabled(): boolean;
|
|
33
|
+
describedBy(): string | null;
|
|
34
|
+
userClass: _angular_core.InputSignal<ClassValue>;
|
|
35
|
+
labelClass: _angular_core.InputSignal<string>;
|
|
36
|
+
groupClass: _angular_core.InputSignal<string>;
|
|
37
|
+
errorClass: _angular_core.InputSignal<string>;
|
|
38
|
+
hintClass: _angular_core.InputSignal<string>;
|
|
39
|
+
$userClass: _angular_core.Signal<string>;
|
|
40
|
+
$labelClass: _angular_core.Signal<string>;
|
|
41
|
+
$groupClass: _angular_core.Signal<string>;
|
|
42
|
+
$errorClass: _angular_core.Signal<string>;
|
|
43
|
+
$hintClass: _angular_core.Signal<string>;
|
|
44
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<EgFormRadioGroup, never>;
|
|
45
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<EgFormRadioGroup, "eg-form-radio-group", never, { "label": { "alias": "label"; "required": false; "isSignal": true; }; "controlId": { "alias": "controlId"; "required": false; "isSignal": true; }; "controlName": { "alias": "controlName"; "required": false; "isSignal": true; }; "error": { "alias": "error"; "required": false; "isSignal": true; }; "hint": { "alias": "hint"; "required": false; "isSignal": true; }; "id": { "alias": "id"; "required": false; "isSignal": true; }; "name": { "alias": "name"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "required": { "alias": "required"; "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; }; "groupClass": { "alias": "groupClass"; "required": false; "isSignal": true; }; "errorClass": { "alias": "errorClass"; "required": false; "isSignal": true; }; "hintClass": { "alias": "hintClass"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
interface EgFormRadioGroupConfig {
|
|
49
|
+
/**
|
|
50
|
+
* Global class defaults for `eg-form-radio-group` styling slots.
|
|
51
|
+
* Each is merged under the matching per-instance `*Class` input
|
|
52
|
+
* (library base < global config < per-instance).
|
|
53
|
+
*/
|
|
54
|
+
labelClass?: string;
|
|
55
|
+
groupClass?: string;
|
|
56
|
+
errorClass?: string;
|
|
57
|
+
hintClass?: string;
|
|
58
|
+
}
|
|
59
|
+
declare function provideEgFormRadioGroupConfig(config: Partial<EgFormRadioGroupConfig>): ValueProvider;
|
|
60
|
+
declare function injectEgFormRadioGroupConfig(): EgFormRadioGroupConfig;
|
|
61
|
+
|
|
62
|
+
export { EgFormRadioGroup, injectEgFormRadioGroupConfig, provideEgFormRadioGroupConfig };
|
|
63
|
+
export type { EgFormRadioGroupConfig };
|
|
@@ -89,7 +89,7 @@ Real selectors involved: `eg-form-searchable-multiselect` (this wrapper), `eg-fo
|
|
|
89
89
|
| `disabled` | `boolean` | `false` | Wrapper-level disable, forwarded as `wrapperDisabled` to the inner multiselect. |
|
|
90
90
|
| `required` | `boolean` | `false` | Adds `required` to the inner control and renders a red `*` next to the label. |
|
|
91
91
|
| `options` | `SelectOption[]` | `[]` | `{ label: string; value: string }[]` forwarded to the inner multiselect. |
|
|
92
|
-
| `class` (`userClass`) | `ClassValue` | `''` | Extra classes for the host (merged over `tw:
|
|
92
|
+
| `class` (`userClass`) | `ClassValue` | `''` | Extra classes for the host (merged over `tw:w-full`). |
|
|
93
93
|
| `labelClass` | `string` | `''` | Extra classes for the `<label>` (merged over `tw:mb-1 tw:gap-0`). |
|
|
94
94
|
| `controlClass` | `string` | `''` | Extra classes for the inner multiselect (merged over `tw:w-full`). |
|
|
95
95
|
| `errorClass` | `string` | `''` | Extra classes for `<hlm-error>` (merged over `tw:mt-0`). |
|
|
@@ -354,6 +354,16 @@ export class ProgrammaticExample {
|
|
|
354
354
|
|
|
355
355
|
No component-specific CSS variables; styling flows through the shared theme tokens (`--radius`, `--popover`, `--ring`, …) consumed by the inner popover/checkbox classes. Use `class` / `labelClass` / `controlClass` / `errorClass` / `hintClass` to append utilities.
|
|
356
356
|
|
|
357
|
+
Global defaults per styling slot via the wrapper config (precedence: library base < global config < per-instance):
|
|
358
|
+
|
|
359
|
+
```ts
|
|
360
|
+
import { provideEgFormSearchableMultiselectConfig } from '@egose/shadcn-theme-ng/form-searchable-multiselect';
|
|
361
|
+
|
|
362
|
+
await bootstrapApplication(App, {
|
|
363
|
+
providers: [provideEgFormSearchableMultiselectConfig({ controlClass: 'tw:text-sm', labelClass: 'tw:font-medium' })],
|
|
364
|
+
});
|
|
365
|
+
```
|
|
366
|
+
|
|
357
367
|
## Related subpaths
|
|
358
368
|
|
|
359
369
|
- `@egose/shadcn-theme-ng/searchable-multiselect` — the underlying `EgSearchableMultiselect` + `SelectOption` (use it directly for template-driven or non-form usage).
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { inject, input, computed, Component } from '@angular/core';
|
|
2
|
+
import { InjectionToken, inject, input, computed, Component } from '@angular/core';
|
|
3
3
|
import * as i1 from '@angular/forms';
|
|
4
4
|
import { FormGroupDirective, ReactiveFormsModule, ControlContainer } from '@angular/forms';
|
|
5
5
|
import { HlmLabel } from '@egose/shadcn-theme-ng-tw/label';
|
|
@@ -8,9 +8,18 @@ import { HlmFormIdGenerator, HlmError, HlmHint } from '@egose/shadcn-theme-ng-tw
|
|
|
8
8
|
import { hlm } from '@egose/shadcn-theme-ng-tw/utils';
|
|
9
9
|
import { EgSearchableMultiselect } from '@egose/shadcn-theme-ng-tw/searchable-multiselect';
|
|
10
10
|
|
|
11
|
+
const EgFormSearchableMultiselectConfigToken = new InjectionToken('EgFormSearchableMultiselectConfig');
|
|
12
|
+
function provideEgFormSearchableMultiselectConfig(config) {
|
|
13
|
+
return { provide: EgFormSearchableMultiselectConfigToken, useValue: { ...config } };
|
|
14
|
+
}
|
|
15
|
+
function injectEgFormSearchableMultiselectConfig() {
|
|
16
|
+
return inject(EgFormSearchableMultiselectConfigToken, { optional: true }) ?? {};
|
|
17
|
+
}
|
|
18
|
+
|
|
11
19
|
class EgFormSearchableMultiselect {
|
|
12
20
|
formGroupDirective = inject(FormGroupDirective);
|
|
13
21
|
generatedId = inject(HlmFormIdGenerator).generate('eg-form-searchable-multiselect');
|
|
22
|
+
_config = injectEgFormSearchableMultiselectConfig();
|
|
14
23
|
// Form field inputs
|
|
15
24
|
label = input(undefined, /* @ts-ignore */
|
|
16
25
|
...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
@@ -58,19 +67,19 @@ class EgFormSearchableMultiselect {
|
|
|
58
67
|
...(ngDevMode ? [{ debugName: "errorClass" }] : /* istanbul ignore next */ []));
|
|
59
68
|
hintClass = input('', /* @ts-ignore */
|
|
60
69
|
...(ngDevMode ? [{ debugName: "hintClass" }] : /* istanbul ignore next */ []));
|
|
61
|
-
// Computed class names
|
|
62
|
-
$userClass = computed(() => hlm('tw:
|
|
70
|
+
// Computed class names (library base < global config < per-instance)
|
|
71
|
+
$userClass = computed(() => hlm('tw:w-full', this.userClass()), /* @ts-ignore */
|
|
63
72
|
...(ngDevMode ? [{ debugName: "$userClass" }] : /* istanbul ignore next */ []));
|
|
64
|
-
$labelClass = computed(() => hlm('tw:mb-1 tw:gap-0', this.labelClass()), /* @ts-ignore */
|
|
73
|
+
$labelClass = computed(() => hlm('tw:mb-1 tw:gap-0', this._config.labelClass, this.labelClass()), /* @ts-ignore */
|
|
65
74
|
...(ngDevMode ? [{ debugName: "$labelClass" }] : /* istanbul ignore next */ []));
|
|
66
|
-
$controlClass = computed(() => hlm('tw:w-full', this.controlClass()), /* @ts-ignore */
|
|
75
|
+
$controlClass = computed(() => hlm('tw:w-full', this._config.controlClass, this.controlClass()), /* @ts-ignore */
|
|
67
76
|
...(ngDevMode ? [{ debugName: "$controlClass" }] : /* istanbul ignore next */ []));
|
|
68
|
-
$errorClass = computed(() => hlm('tw:mt-0', this.errorClass()), /* @ts-ignore */
|
|
77
|
+
$errorClass = computed(() => hlm('tw:mt-0', this._config.errorClass, this.errorClass()), /* @ts-ignore */
|
|
69
78
|
...(ngDevMode ? [{ debugName: "$errorClass" }] : /* istanbul ignore next */ []));
|
|
70
|
-
$hintClass = computed(() => hlm('tw:mt-0', this.hintClass()), /* @ts-ignore */
|
|
79
|
+
$hintClass = computed(() => hlm('tw:mt-0', this._config.hintClass, this.hintClass()), /* @ts-ignore */
|
|
71
80
|
...(ngDevMode ? [{ debugName: "$hintClass" }] : /* istanbul ignore next */ []));
|
|
72
81
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: EgFormSearchableMultiselect, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
73
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.3", type: EgFormSearchableMultiselect, isStandalone: true, selector: "eg-form-searchable-multiselect", 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 }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", 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 }, errorClass: { classPropertyName: "errorClass", publicName: "errorClass", isSignal: true, isRequired: false, transformFunction: null }, hintClass: { classPropertyName: "hintClass", publicName: "hintClass", isSignal: true, isRequired: false, transformFunction: null } }, host: {
|
|
82
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.3", type: EgFormSearchableMultiselect, isStandalone: true, selector: "eg-form-searchable-multiselect", 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 }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", 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 }, errorClass: { classPropertyName: "errorClass", publicName: "errorClass", isSignal: true, isRequired: false, transformFunction: null }, hintClass: { classPropertyName: "hintClass", publicName: "hintClass", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "$userClass()" } }, providers: [{ provide: ControlContainer, useExisting: FormGroupDirective }], ngImport: i0, template: `
|
|
74
83
|
@let lbl = label();
|
|
75
84
|
@let cnm = controlName();
|
|
76
85
|
@let err = error();
|
|
@@ -118,7 +127,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImpor
|
|
|
118
127
|
selector: 'eg-form-searchable-multiselect',
|
|
119
128
|
standalone: true,
|
|
120
129
|
host: {
|
|
121
|
-
class: '
|
|
130
|
+
'[class]': '$userClass()',
|
|
122
131
|
},
|
|
123
132
|
imports: [ReactiveFormsModule, EgFormField, HlmError, HlmHint, HlmLabel, EgSearchableMultiselect],
|
|
124
133
|
providers: [{ provide: ControlContainer, useExisting: FormGroupDirective }],
|
|
@@ -174,5 +183,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImpor
|
|
|
174
183
|
* Generated bundle index. Do not edit.
|
|
175
184
|
*/
|
|
176
185
|
|
|
177
|
-
export { EgFormSearchableMultiselect };
|
|
186
|
+
export { EgFormSearchableMultiselect, injectEgFormSearchableMultiselectConfig, provideEgFormSearchableMultiselectConfig };
|
|
178
187
|
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import * as _angular_core from '@angular/core';
|
|
2
|
+
import { ValueProvider } from '@angular/core';
|
|
2
3
|
import { ClassValue } from 'clsx';
|
|
3
4
|
import { SelectOption } from '@egose/shadcn-theme-ng-tw/searchable-multiselect';
|
|
4
5
|
|
|
5
6
|
declare class EgFormSearchableMultiselect {
|
|
6
7
|
private readonly formGroupDirective;
|
|
7
8
|
private readonly generatedId;
|
|
9
|
+
private readonly _config;
|
|
8
10
|
label: _angular_core.InputSignal<string | undefined>;
|
|
9
11
|
controlId: _angular_core.InputSignal<string | undefined>;
|
|
10
12
|
controlName: _angular_core.InputSignal<string>;
|
|
@@ -33,4 +35,19 @@ declare class EgFormSearchableMultiselect {
|
|
|
33
35
|
static ɵcmp: _angular_core.ɵɵComponentDeclaration<EgFormSearchableMultiselect, "eg-form-searchable-multiselect", 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; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "required": { "alias": "required"; "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; }; "errorClass": { "alias": "errorClass"; "required": false; "isSignal": true; }; "hintClass": { "alias": "hintClass"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
34
36
|
}
|
|
35
37
|
|
|
36
|
-
|
|
38
|
+
interface EgFormSearchableMultiselectConfig {
|
|
39
|
+
/**
|
|
40
|
+
* Global class defaults for `eg-form-searchable-multiselect` styling slots.
|
|
41
|
+
* Each is merged under the matching per-instance `*Class` input
|
|
42
|
+
* (library base < global config < per-instance).
|
|
43
|
+
*/
|
|
44
|
+
labelClass?: string;
|
|
45
|
+
controlClass?: string;
|
|
46
|
+
errorClass?: string;
|
|
47
|
+
hintClass?: string;
|
|
48
|
+
}
|
|
49
|
+
declare function provideEgFormSearchableMultiselectConfig(config: Partial<EgFormSearchableMultiselectConfig>): ValueProvider;
|
|
50
|
+
declare function injectEgFormSearchableMultiselectConfig(): EgFormSearchableMultiselectConfig;
|
|
51
|
+
|
|
52
|
+
export { EgFormSearchableMultiselect, injectEgFormSearchableMultiselectConfig, provideEgFormSearchableMultiselectConfig };
|
|
53
|
+
export type { EgFormSearchableMultiselectConfig };
|
package/form-select/README.md
CHANGED
|
@@ -343,6 +343,16 @@ export class ProgrammaticExample {
|
|
|
343
343
|
|
|
344
344
|
No component-specific CSS variables; visuals come from the shared theme tokens via the `HlmSelect*` parts. Use `selectClass` / `labelClass` / `errorClass` / `hintClass` / `class` to adjust sizing and spacing.
|
|
345
345
|
|
|
346
|
+
Global defaults per styling slot via the wrapper config (precedence: library base < global config < per-instance):
|
|
347
|
+
|
|
348
|
+
```ts
|
|
349
|
+
import { provideEgFormSelectConfig } from '@egose/shadcn-theme-ng/form-select';
|
|
350
|
+
|
|
351
|
+
await bootstrapApplication(App, {
|
|
352
|
+
providers: [provideEgFormSelectConfig({ selectClass: 'tw:text-sm', labelClass: 'tw:font-medium' })],
|
|
353
|
+
});
|
|
354
|
+
```
|
|
355
|
+
|
|
346
356
|
## Related subpaths
|
|
347
357
|
|
|
348
358
|
- `@egose/shadcn-theme-ng/select` — raw `HlmSelect`, `HlmSelectTrigger`, `HlmSelectValue`, `HlmSelectContent`, `HlmSelectItem`, `HlmSelectLabel` for custom layouts and grouped sections.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { inject, input, computed, Component } from '@angular/core';
|
|
2
|
+
import { InjectionToken, inject, input, computed, Component } from '@angular/core';
|
|
3
3
|
import * as i1 from '@angular/forms';
|
|
4
4
|
import { FormGroupDirective, ReactiveFormsModule, ControlContainer } from '@angular/forms';
|
|
5
5
|
import { HlmFormIdGenerator, HlmFormField, HlmError, HlmHint } from '@egose/shadcn-theme-ng-tw/form-field';
|
|
@@ -9,9 +9,18 @@ import { BrnSelectImports } from '@spartan-ng/brain/select';
|
|
|
9
9
|
import * as i2 from '@egose/shadcn-theme-ng-tw/select';
|
|
10
10
|
import { HlmSelectImports, HlmSelect, HlmSelectTrigger, HlmSelectValue, HlmSelectContent, HlmSelectItem, HlmSelectLabel } from '@egose/shadcn-theme-ng-tw/select';
|
|
11
11
|
|
|
12
|
+
const EgFormSelectConfigToken = new InjectionToken('EgFormSelectConfig');
|
|
13
|
+
function provideEgFormSelectConfig(config) {
|
|
14
|
+
return { provide: EgFormSelectConfigToken, useValue: { ...config } };
|
|
15
|
+
}
|
|
16
|
+
function injectEgFormSelectConfig() {
|
|
17
|
+
return inject(EgFormSelectConfigToken, { optional: true }) ?? {};
|
|
18
|
+
}
|
|
19
|
+
|
|
12
20
|
class EgFormSelect {
|
|
13
21
|
formGroupDirective = inject(FormGroupDirective);
|
|
14
22
|
generatedId = inject(HlmFormIdGenerator).generate('eg-form-select');
|
|
23
|
+
_config = injectEgFormSelectConfig();
|
|
15
24
|
label = input(undefined, /* @ts-ignore */
|
|
16
25
|
...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
17
26
|
controlId = input(undefined, /* @ts-ignore */
|
|
@@ -62,19 +71,19 @@ class EgFormSelect {
|
|
|
62
71
|
...(ngDevMode ? [{ debugName: "errorClass" }] : /* istanbul ignore next */ []));
|
|
63
72
|
hintClass = input('', /* @ts-ignore */
|
|
64
73
|
...(ngDevMode ? [{ debugName: "hintClass" }] : /* istanbul ignore next */ []));
|
|
65
|
-
// Computed classes
|
|
66
|
-
$userClass = computed(() => hlm('tw:
|
|
74
|
+
// Computed classes (library base < global config < per-instance)
|
|
75
|
+
$userClass = computed(() => hlm('tw:w-full', this.userClass()), /* @ts-ignore */
|
|
67
76
|
...(ngDevMode ? [{ debugName: "$userClass" }] : /* istanbul ignore next */ []));
|
|
68
|
-
$labelClass = computed(() => hlm('tw:mb-1 tw:gap-0', this.labelClass()), /* @ts-ignore */
|
|
77
|
+
$labelClass = computed(() => hlm('tw:mb-1 tw:gap-0', this._config.labelClass, this.labelClass()), /* @ts-ignore */
|
|
69
78
|
...(ngDevMode ? [{ debugName: "$labelClass" }] : /* istanbul ignore next */ []));
|
|
70
|
-
$selectClass = computed(() => hlm('tw:w-full', this.selectClass()), /* @ts-ignore */
|
|
79
|
+
$selectClass = computed(() => hlm('tw:w-full', this._config.selectClass, this.selectClass()), /* @ts-ignore */
|
|
71
80
|
...(ngDevMode ? [{ debugName: "$selectClass" }] : /* istanbul ignore next */ []));
|
|
72
|
-
$errorClass = computed(() => hlm('tw:mt-0', this.errorClass()), /* @ts-ignore */
|
|
81
|
+
$errorClass = computed(() => hlm('tw:mt-0', this._config.errorClass, this.errorClass()), /* @ts-ignore */
|
|
73
82
|
...(ngDevMode ? [{ debugName: "$errorClass" }] : /* istanbul ignore next */ []));
|
|
74
|
-
$hintClass = computed(() => hlm('tw:mt-0', this.hintClass()), /* @ts-ignore */
|
|
83
|
+
$hintClass = computed(() => hlm('tw:mt-0', this._config.hintClass, this.hintClass()), /* @ts-ignore */
|
|
75
84
|
...(ngDevMode ? [{ debugName: "$hintClass" }] : /* istanbul ignore next */ []));
|
|
76
85
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: EgFormSelect, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
77
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.3", type: EgFormSelect, isStandalone: true, selector: "eg-form-select", 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 }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null }, optionsLabel: { classPropertyName: "optionsLabel", publicName: "optionsLabel", 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 }, selectClass: { classPropertyName: "selectClass", publicName: "selectClass", 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: {
|
|
86
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.3", type: EgFormSelect, isStandalone: true, selector: "eg-form-select", 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 }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null }, optionsLabel: { classPropertyName: "optionsLabel", publicName: "optionsLabel", 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 }, selectClass: { classPropertyName: "selectClass", publicName: "selectClass", isSignal: true, isRequired: false, transformFunction: null }, errorClass: { classPropertyName: "errorClass", publicName: "errorClass", isSignal: true, isRequired: false, transformFunction: null }, hintClass: { classPropertyName: "hintClass", publicName: "hintClass", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "$userClass()" } }, providers: [{ provide: ControlContainer, useExisting: FormGroupDirective }], ngImport: i0, template: `
|
|
78
87
|
@let lbl = label();
|
|
79
88
|
@let cnm = controlName();
|
|
80
89
|
@let err = error();
|
|
@@ -102,7 +111,7 @@ class EgFormSelect {
|
|
|
102
111
|
<hlm-select-value [placeholder]="placeholder()" />
|
|
103
112
|
</hlm-select-trigger>
|
|
104
113
|
|
|
105
|
-
<hlm-select-content>
|
|
114
|
+
<hlm-select-content *hlmSelectPortal>
|
|
106
115
|
@if (options().length) {
|
|
107
116
|
@if (optionsLabel()) {
|
|
108
117
|
<hlm-select-label>{{ optionsLabel() }}</hlm-select-label>
|
|
@@ -124,7 +133,7 @@ class EgFormSelect {
|
|
|
124
133
|
<hlm-select-value [placeholder]="placeholder()" />
|
|
125
134
|
</hlm-select-trigger>
|
|
126
135
|
|
|
127
|
-
<hlm-select-content>
|
|
136
|
+
<hlm-select-content *hlmSelectPortal>
|
|
128
137
|
@if (options().length) {
|
|
129
138
|
@if (optionsLabel()) {
|
|
130
139
|
<hlm-select-label>{{ optionsLabel() }}</hlm-select-label>
|
|
@@ -149,7 +158,7 @@ class EgFormSelect {
|
|
|
149
158
|
</hlm-hint>
|
|
150
159
|
}
|
|
151
160
|
</hlm-form-field>
|
|
152
|
-
`, 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: i2.HlmSelect, selector: "[hlmSelect],hlm-select" }, { kind: "component", type: i2.HlmSelectContent, selector: "hlm-select-content", inputs: ["showScroll"] }, { kind: "component", type: i2.HlmSelectItem, selector: "hlm-select-item" }, { kind: "directive", type: i2.HlmSelectLabel, selector: "[hlmSelectLabel],hlm-select-label" }, { kind: "component", type: i2.HlmSelectTrigger, selector: "hlm-select-trigger", inputs: ["class", "buttonId", "ariaDescribedby", "wrapperDisabled", "size", "forceInvalid"] }, { kind: "directive", type: i2.HlmSelectValue, selector: "[hlmSelectValue],hlm-select-value" }] });
|
|
161
|
+
`, 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: i2.HlmSelect, selector: "[hlmSelect],hlm-select" }, { kind: "component", type: i2.HlmSelectContent, selector: "hlm-select-content", inputs: ["showScroll"] }, { kind: "component", type: i2.HlmSelectItem, selector: "hlm-select-item" }, { kind: "directive", type: i2.HlmSelectLabel, selector: "[hlmSelectLabel],hlm-select-label" }, { kind: "directive", type: i2.HlmSelectPortal, selector: "[hlmSelectPortal]" }, { kind: "component", type: i2.HlmSelectTrigger, selector: "hlm-select-trigger", inputs: ["class", "buttonId", "ariaDescribedby", "wrapperDisabled", "size", "forceInvalid"] }, { kind: "directive", type: i2.HlmSelectValue, selector: "[hlmSelectValue],hlm-select-value" }] });
|
|
153
162
|
}
|
|
154
163
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: EgFormSelect, decorators: [{
|
|
155
164
|
type: Component,
|
|
@@ -157,7 +166,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImpor
|
|
|
157
166
|
selector: 'eg-form-select',
|
|
158
167
|
standalone: true,
|
|
159
168
|
host: {
|
|
160
|
-
class: '
|
|
169
|
+
'[class]': '$userClass()',
|
|
161
170
|
},
|
|
162
171
|
imports: [
|
|
163
172
|
ReactiveFormsModule,
|
|
@@ -203,7 +212,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImpor
|
|
|
203
212
|
<hlm-select-value [placeholder]="placeholder()" />
|
|
204
213
|
</hlm-select-trigger>
|
|
205
214
|
|
|
206
|
-
<hlm-select-content>
|
|
215
|
+
<hlm-select-content *hlmSelectPortal>
|
|
207
216
|
@if (options().length) {
|
|
208
217
|
@if (optionsLabel()) {
|
|
209
218
|
<hlm-select-label>{{ optionsLabel() }}</hlm-select-label>
|
|
@@ -225,7 +234,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImpor
|
|
|
225
234
|
<hlm-select-value [placeholder]="placeholder()" />
|
|
226
235
|
</hlm-select-trigger>
|
|
227
236
|
|
|
228
|
-
<hlm-select-content>
|
|
237
|
+
<hlm-select-content *hlmSelectPortal>
|
|
229
238
|
@if (options().length) {
|
|
230
239
|
@if (optionsLabel()) {
|
|
231
240
|
<hlm-select-label>{{ optionsLabel() }}</hlm-select-label>
|
|
@@ -262,5 +271,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImpor
|
|
|
262
271
|
* Generated bundle index. Do not edit.
|
|
263
272
|
*/
|
|
264
273
|
|
|
265
|
-
export { EgFormSelect };
|
|
274
|
+
export { EgFormSelect, injectEgFormSelectConfig, provideEgFormSelectConfig };
|
|
266
275
|
|
|
@@ -1,4 +1,5 @@
|
|
|
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
|
interface SelectOption {
|
|
@@ -8,6 +9,7 @@ interface SelectOption {
|
|
|
8
9
|
declare class EgFormSelect {
|
|
9
10
|
private readonly formGroupDirective;
|
|
10
11
|
private readonly generatedId;
|
|
12
|
+
private readonly _config;
|
|
11
13
|
label: _angular_core.InputSignal<string | undefined>;
|
|
12
14
|
controlId: _angular_core.InputSignal<string | undefined>;
|
|
13
15
|
controlName: _angular_core.InputSignal<string>;
|
|
@@ -38,4 +40,19 @@ declare class EgFormSelect {
|
|
|
38
40
|
static ɵcmp: _angular_core.ɵɵComponentDeclaration<EgFormSelect, "eg-form-select", 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; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "required": { "alias": "required"; "required": false; "isSignal": true; }; "multiple": { "alias": "multiple"; "required": false; "isSignal": true; }; "options": { "alias": "options"; "required": false; "isSignal": true; }; "optionsLabel": { "alias": "optionsLabel"; "required": false; "isSignal": true; }; "userClass": { "alias": "class"; "required": false; "isSignal": true; }; "labelClass": { "alias": "labelClass"; "required": false; "isSignal": true; }; "selectClass": { "alias": "selectClass"; "required": false; "isSignal": true; }; "errorClass": { "alias": "errorClass"; "required": false; "isSignal": true; }; "hintClass": { "alias": "hintClass"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
39
41
|
}
|
|
40
42
|
|
|
41
|
-
|
|
43
|
+
interface EgFormSelectConfig {
|
|
44
|
+
/**
|
|
45
|
+
* Global class defaults for `eg-form-select` styling slots.
|
|
46
|
+
* Each is merged under the matching per-instance `*Class` input
|
|
47
|
+
* (library base < global config < per-instance).
|
|
48
|
+
*/
|
|
49
|
+
labelClass?: string;
|
|
50
|
+
selectClass?: string;
|
|
51
|
+
errorClass?: string;
|
|
52
|
+
hintClass?: string;
|
|
53
|
+
}
|
|
54
|
+
declare function provideEgFormSelectConfig(config: Partial<EgFormSelectConfig>): ValueProvider;
|
|
55
|
+
declare function injectEgFormSelectConfig(): EgFormSelectConfig;
|
|
56
|
+
|
|
57
|
+
export { EgFormSelect, injectEgFormSelectConfig, provideEgFormSelectConfig };
|
|
58
|
+
export type { EgFormSelectConfig };
|