@egose/shadcn-theme-ng 0.2.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/autocomplete/fesm2022/autocomplete.mjs +1 -1
- package/checkbox/fesm2022/checkbox.mjs +6 -7
- package/checkbox/types/checkbox.d.ts +1 -1
- package/combobox/fesm2022/combobox.mjs +1 -1
- package/date-picker/README.md +15 -11
- package/date-picker/fesm2022/date-picker.mjs +148 -30
- package/date-picker/types/date-picker.d.ts +102 -9
- package/form-autocomplete/README.md +178 -0
- package/form-autocomplete/fesm2022/form-autocomplete.mjs +159 -0
- package/form-autocomplete/package.json +24 -0
- package/form-autocomplete/types/form-autocomplete.d.ts +81 -0
- package/form-checkbox/README.md +29 -18
- package/form-checkbox/fesm2022/form-checkbox.mjs +59 -17
- package/form-checkbox/types/form-checkbox.d.ts +43 -4
- package/form-combobox/README.md +203 -0
- package/form-combobox/fesm2022/form-combobox.mjs +181 -0
- package/form-combobox/package.json +24 -0
- package/form-combobox/types/form-combobox.d.ts +93 -0
- package/form-date-picker/README.md +49 -22
- package/form-date-picker/fesm2022/form-date-picker.mjs +74 -19
- package/form-date-picker/types/form-date-picker.d.ts +37 -1
- package/form-date-picker-multi/README.md +192 -0
- package/form-date-picker-multi/fesm2022/form-date-picker-multi.mjs +158 -0
- package/form-date-picker-multi/package.json +24 -0
- package/form-date-picker-multi/types/form-date-picker-multi.d.ts +78 -0
- package/form-date-range-picker/README.md +254 -0
- package/form-date-range-picker/fesm2022/form-date-range-picker.mjs +159 -0
- package/form-date-range-picker/package.json +24 -0
- package/form-date-range-picker/types/form-date-range-picker.d.ts +75 -0
- package/form-field/README.md +9 -0
- package/form-field/fesm2022/form-field.mjs +80 -5
- package/form-field/types/form-field.d.ts +50 -2
- package/form-field-simple/fesm2022/form-field-simple.mjs +15 -1
- package/form-field-simple/types/form-field-simple.d.ts +9 -2
- package/form-input-otp/README.md +195 -0
- package/form-input-otp/fesm2022/form-input-otp.mjs +140 -0
- package/form-input-otp/package.json +24 -0
- package/form-input-otp/types/form-input-otp.d.ts +78 -0
- package/form-month-year-picker/README.md +189 -0
- package/form-month-year-picker/fesm2022/form-month-year-picker.mjs +154 -0
- package/form-month-year-picker/package.json +24 -0
- package/form-month-year-picker/types/form-month-year-picker.d.ts +73 -0
- package/form-native-select/README.md +206 -0
- package/form-native-select/fesm2022/form-native-select.mjs +132 -0
- package/form-native-select/package.json +24 -0
- package/form-native-select/types/form-native-select.d.ts +77 -0
- package/form-phone-input/README.md +189 -0
- package/form-phone-input/fesm2022/form-phone-input.mjs +142 -0
- package/form-phone-input/package.json +24 -0
- package/form-phone-input/types/form-phone-input.d.ts +78 -0
- package/form-radio-group/README.md +199 -0
- package/form-radio-group/fesm2022/form-radio-group.mjs +140 -0
- package/form-radio-group/package.json +24 -0
- package/form-radio-group/types/form-radio-group.d.ts +83 -0
- package/form-searchable-multiselect/README.md +28 -17
- package/form-searchable-multiselect/fesm2022/form-searchable-multiselect.mjs +57 -19
- package/form-searchable-multiselect/types/form-searchable-multiselect.d.ts +39 -2
- package/form-select/README.md +30 -19
- package/form-select/fesm2022/form-select.mjs +57 -19
- package/form-select/types/form-select.d.ts +39 -2
- package/form-slider/README.md +183 -0
- package/form-slider/fesm2022/form-slider.mjs +140 -0
- package/form-slider/package.json +24 -0
- package/form-slider/types/form-slider.d.ts +80 -0
- package/form-switch/README.md +174 -0
- package/form-switch/fesm2022/form-switch.mjs +129 -0
- package/form-switch/package.json +24 -0
- package/form-switch/types/form-switch.d.ts +70 -0
- package/form-text-input/README.md +37 -26
- package/form-text-input/fesm2022/form-text-input.mjs +57 -19
- package/form-text-input/types/form-text-input.d.ts +39 -2
- package/form-textarea/README.md +33 -22
- package/form-textarea/fesm2022/form-textarea.mjs +57 -19
- package/form-textarea/types/form-textarea.d.ts +39 -2
- package/form-toggle/README.md +187 -0
- package/form-toggle/fesm2022/form-toggle.mjs +193 -0
- package/form-toggle/package.json +24 -0
- package/form-toggle/types/form-toggle.d.ts +100 -0
- package/form-toggle-group/README.md +177 -0
- package/form-toggle-group/fesm2022/form-toggle-group.mjs +145 -0
- package/form-toggle-group/package.json +24 -0
- package/form-toggle-group/types/form-toggle-group.d.ts +85 -0
- package/input-group/fesm2022/input-group.mjs +19 -9
- package/input-group/types/input-group.d.ts +4 -1
- package/native-select/fesm2022/native-select.mjs +18 -6
- package/native-select/types/native-select.d.ts +7 -2
- package/package.json +57 -1
- package/phone-input/README.md +114 -0
- package/phone-input/fesm2022/phone-input.mjs +191 -0
- package/phone-input/package.json +24 -0
- package/phone-input/types/phone-input.d.ts +67 -0
- package/radio-group/types/radio-group.d.ts +1 -1
- package/switch/fesm2022/switch.mjs +7 -5
- package/switch/types/switch.d.ts +2 -1
- package/typography/types/typography.d.ts +8 -8
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
# Form Radio Group (`@egose/shadcn-theme-ng/form-radio-group`)
|
|
2
|
+
|
|
3
|
+
A ready-made reactive-form radio field: group label + `hlm-radio-group` options + validation error/hint display in one tag.
|
|
4
|
+
|
|
5
|
+
The Angular implementation is a standalone wrapper: it renders `HlmFormField` / `HlmError` / `HlmHint` from `@egose/shadcn-theme-ng/form-field`, `HlmLabel`, and `HlmRadioGroup` / `HlmRadio` / `HlmRadioIndicator` from `@egose/shadcn-theme-ng/radio-group`. The group is bound with `[formControlName]="controlName()"`, so the parent `FormGroup` owns the `string` value. It must live inside a `FormGroupDirective` (`[formGroup]` parent); ids come from `HlmFormIdGenerator` unless overridden.
|
|
6
|
+
|
|
7
|
+
> **Ships as:** `@egose/shadcn-theme-ng/form-radio-group` and `@egose/shadcn-theme-ng-tw/form-radio-group`
|
|
8
|
+
> (the `tw:`-prefixed Tailwind variant). Both expose the identical TypeScript surface; only the
|
|
9
|
+
> emitted Tailwind class strings differ. See the [package README](../../README.md) for install
|
|
10
|
+
> steps, peer dependencies, and Tailwind setup. Do not publish this project directory independently.
|
|
11
|
+
|
|
12
|
+
## Installation
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
# Plain Tailwind (no prefix)
|
|
16
|
+
npm install @egose/shadcn-theme-ng
|
|
17
|
+
|
|
18
|
+
# tw:-prefixed Tailwind variant
|
|
19
|
+
npm install @egose/shadcn-theme-ng-tw
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Peer dependencies (Angular, `@spartan-ng/brain`, `rxjs`, …) are documented in the
|
|
23
|
+
[package README](../../README.md#peer-dependencies). This subpath additionally relies at runtime on
|
|
24
|
+
`@egose/shadcn-theme-ng/radio-group`, `@egose/shadcn-theme-ng/form-field`, and
|
|
25
|
+
`@egose/shadcn-theme-ng/label`.
|
|
26
|
+
|
|
27
|
+
## Imports
|
|
28
|
+
|
|
29
|
+
Exported from the subpath root (`projects/form-radio-group/src/public-api.ts`):
|
|
30
|
+
|
|
31
|
+
```ts
|
|
32
|
+
import { EgFormRadioGroup, provideEgFormRadioGroupConfig } from '@egose/shadcn-theme-ng/form-radio-group';
|
|
33
|
+
// tw variant: replace with '@egose/shadcn-theme-ng-tw/form-radio-group'
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Standalone usage:
|
|
37
|
+
|
|
38
|
+
```ts
|
|
39
|
+
import { Component } from '@angular/core';
|
|
40
|
+
import { ReactiveFormsModule } from '@angular/forms';
|
|
41
|
+
import { EgFormRadioGroup } from '@egose/shadcn-theme-ng/form-radio-group';
|
|
42
|
+
|
|
43
|
+
@Component({
|
|
44
|
+
selector: 'app-demo',
|
|
45
|
+
standalone: true,
|
|
46
|
+
imports: [ReactiveFormsModule, EgFormRadioGroup],
|
|
47
|
+
template: `...`,
|
|
48
|
+
})
|
|
49
|
+
export class DemoComponent {}
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
NgModule-based consumer: add `EgFormRadioGroup` (and `ReactiveFormsModule`) to the module's
|
|
53
|
+
`imports` — it is a standalone component, not a module.
|
|
54
|
+
|
|
55
|
+
`ControlValueAccessor` behavior: `eg-form-radio-group` itself is not a `ControlValueAccessor`; the
|
|
56
|
+
inner `hlm-radio-group` is (bound via `formControlName`), so `formControlName`/`formGroup` handling,
|
|
57
|
+
`Validators`, and `disabled` state from the control all flow through the parent form.
|
|
58
|
+
|
|
59
|
+
## Anatomy / Structure
|
|
60
|
+
|
|
61
|
+
```html
|
|
62
|
+
<form [formGroup]="form">
|
|
63
|
+
<eg-form-radio-group controlName="plan" label="Plan" [options]="plans" [required]="true" error="Plan is required." />
|
|
64
|
+
</form>
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Selector (from source): `eg-form-radio-group` (standalone component, host `tw:w-full`).
|
|
68
|
+
|
|
69
|
+
## API reference
|
|
70
|
+
|
|
71
|
+
### `EgFormRadioGroup` — `eg-form-radio-group`
|
|
72
|
+
|
|
73
|
+
| Input | Type | Default | Description |
|
|
74
|
+
| ------------- | ------------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
75
|
+
| `controlName` | `string` | `''` | `formControlName` key inside the parent `FormGroup`. **Required.** |
|
|
76
|
+
| `label` | `string \| undefined` | — | Group label text (hidden when omitted). |
|
|
77
|
+
| `error` | `string \| undefined` | — | Error text shown when invalid. |
|
|
78
|
+
| `autoError` | `boolean` | `true` | Auto-resolve the message from the control's `ValidationErrors` when `error` is unset. Explicit `error` always wins; `error=""` counts as unset. Global wording via `provideEgFormErrorMessages`. |
|
|
79
|
+
| `hint` | `string \| undefined` | — | Hint text shown otherwise. |
|
|
80
|
+
| `controlId` | `string \| undefined` | — | Explicit id prefix (first priority for `effectiveId`). |
|
|
81
|
+
| `id` | `string \| undefined` | — | Fallback id prefix (second priority). |
|
|
82
|
+
| `name` | `string \| undefined` | — | Native group `name` (`controlName` wins when set). |
|
|
83
|
+
| `disabled` | `boolean` | `false` | Locks interaction (form control stays enabled). |
|
|
84
|
+
| `required` | `boolean` | `false` | Shows a red `*` next to the label; forwarded to the group. |
|
|
85
|
+
| `options` | `{ value, label, disabled? }[]` | `[]` | Rendered as labelled `hlm-radio` options. |
|
|
86
|
+
| `class` | `ClassValue` | `''` | Extra host classes (base `tw:w-full`). |
|
|
87
|
+
| `labelClass` | `string` | `''` | Extra group-label classes (base `tw:mb-1`). |
|
|
88
|
+
| `groupClass` | `string` | `''` | Extra group classes (base `tw:flex tw:flex-col tw:gap-2`). |
|
|
89
|
+
| `errorClass` | `string` | `''` | Extra error classes (base `tw:mt-0`). |
|
|
90
|
+
| `hintClass` | `string` | `''` | Extra hint classes (base `tw:mt-0`). |
|
|
91
|
+
|
|
92
|
+
| Member | Description |
|
|
93
|
+
| -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
94
|
+
| `effectiveId` | `controlId() \|\| id() \|\| generated` — id prefix for `errorId` / `hintId`. |
|
|
95
|
+
| `errorId` / `hintId` | `effectiveId + '-error' / '-hint'`. |
|
|
96
|
+
| `describedBy()` | `errorId` when `error()` is set and control is invalid + dirty/touched, else `hintId` when `hint()` is set, else `null` — wired to each radio's `aria-describedby`. |
|
|
97
|
+
|
|
98
|
+
Each option renders inside a native `<label>`, so every radio is implicitly labelled by its option text. Requires a `[formGroup]` ancestor (injects `FormGroupDirective`, provides `ControlContainer → FormGroupDirective`).
|
|
99
|
+
|
|
100
|
+
## Examples
|
|
101
|
+
|
|
102
|
+
### 1. Basic required group
|
|
103
|
+
|
|
104
|
+
```ts
|
|
105
|
+
import { Component, inject } from '@angular/core';
|
|
106
|
+
import { FormBuilder, ReactiveFormsModule, Validators } from '@angular/forms';
|
|
107
|
+
import { EgFormRadioGroup } from '@egose/shadcn-theme-ng/form-radio-group';
|
|
108
|
+
|
|
109
|
+
@Component({
|
|
110
|
+
selector: 'app-plan',
|
|
111
|
+
standalone: true,
|
|
112
|
+
imports: [ReactiveFormsModule, EgFormRadioGroup],
|
|
113
|
+
template: `
|
|
114
|
+
<form [formGroup]="form" (ngSubmit)="submit()">
|
|
115
|
+
<eg-form-radio-group
|
|
116
|
+
controlName="plan"
|
|
117
|
+
label="Plan"
|
|
118
|
+
[options]="plans"
|
|
119
|
+
[required]="true"
|
|
120
|
+
error="Plan is required."
|
|
121
|
+
/>
|
|
122
|
+
<button type="submit" [disabled]="form.invalid">Continue</button>
|
|
123
|
+
</form>
|
|
124
|
+
`,
|
|
125
|
+
})
|
|
126
|
+
export class PlanComponent {
|
|
127
|
+
private readonly fb = inject(FormBuilder);
|
|
128
|
+
readonly form = this.fb.group({ plan: ['', Validators.required] });
|
|
129
|
+
readonly plans = [
|
|
130
|
+
{ value: 'starter', label: 'Starter' },
|
|
131
|
+
{ value: 'pro', label: 'Pro' },
|
|
132
|
+
{ value: 'enterprise', label: 'Enterprise', disabled: true },
|
|
133
|
+
];
|
|
134
|
+
submit() {
|
|
135
|
+
console.log(this.form.value.plan);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### 2. Hint + horizontal layout
|
|
141
|
+
|
|
142
|
+
```ts
|
|
143
|
+
import { Component, inject } from '@angular/core';
|
|
144
|
+
import { FormBuilder, ReactiveFormsModule } from '@angular/forms';
|
|
145
|
+
import { EgFormRadioGroup } from '@egose/shadcn-theme-ng/form-radio-group';
|
|
146
|
+
|
|
147
|
+
@Component({
|
|
148
|
+
selector: 'app-billing',
|
|
149
|
+
standalone: true,
|
|
150
|
+
imports: [ReactiveFormsModule, EgFormRadioGroup],
|
|
151
|
+
template: `
|
|
152
|
+
<form [formGroup]="form">
|
|
153
|
+
<eg-form-radio-group
|
|
154
|
+
controlName="cycle"
|
|
155
|
+
label="Billing cycle"
|
|
156
|
+
[options]="cycles"
|
|
157
|
+
groupClass="tw:flex-row tw:gap-4"
|
|
158
|
+
hint="Switch or cancel anytime."
|
|
159
|
+
/>
|
|
160
|
+
</form>
|
|
161
|
+
`,
|
|
162
|
+
})
|
|
163
|
+
export class BillingComponent {
|
|
164
|
+
private readonly fb = inject(FormBuilder);
|
|
165
|
+
readonly form = this.fb.group({ cycle: ['monthly'] });
|
|
166
|
+
readonly cycles = [
|
|
167
|
+
{ value: 'monthly', label: 'Monthly' },
|
|
168
|
+
{ value: 'yearly', label: 'Yearly' },
|
|
169
|
+
];
|
|
170
|
+
}
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
## Accessibility notes
|
|
174
|
+
|
|
175
|
+
- Each radio is wrapped in a native `<label>` with its option text (implicit association), and receives `aria-describedby` (error/hint id) — the group label is visual.
|
|
176
|
+
- The required `*` is visual; pair with `Validators.required` so assistive tech and validation agree.
|
|
177
|
+
|
|
178
|
+
## Theming / CSS variables
|
|
179
|
+
|
|
180
|
+
No component-specific CSS variables. Style per-instance via `class` / `labelClass` / `groupClass` / `errorClass` / `hintClass` (precedence: library base < global config < per-instance).
|
|
181
|
+
|
|
182
|
+
Global defaults per styling slot via the wrapper config:
|
|
183
|
+
|
|
184
|
+
```ts
|
|
185
|
+
import { provideEgFormRadioGroupConfig } from '@egose/shadcn-theme-ng/form-radio-group';
|
|
186
|
+
|
|
187
|
+
await bootstrapApplication(App, {
|
|
188
|
+
providers: [provideEgFormRadioGroupConfig({ groupClass: 'tw:gap-3', labelClass: 'tw:font-medium' })],
|
|
189
|
+
});
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
The host keeps `tw:w-full`; constrain width with `class` or a wrapping container.
|
|
193
|
+
|
|
194
|
+
## Related subpaths
|
|
195
|
+
|
|
196
|
+
- `@egose/shadcn-theme-ng/radio-group` — raw `hlm-radio-group` / `hlm-radio` / `hlm-radio-indicator` for custom layouts.
|
|
197
|
+
- `@egose/shadcn-theme-ng/form-select` — single-choice alternative with a popover (`eg-form-select`).
|
|
198
|
+
- `@egose/shadcn-theme-ng/form-field` — `hlm-form-field` / `hlm-error` / `hlm-hint` used internally.
|
|
199
|
+
- `@egose/shadcn-theme-ng/form-field-simple` — alternative minimal wrapper when you compose controls by hand.
|
|
@@ -0,0 +1,140 @@
|
|
|
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 { injectEgFormErrorMessages, HlmFormIdGenerator, resolveEgFormError, HlmFormField, HlmError, HlmHint } from '@egose/shadcn-theme-ng/form-field';
|
|
6
|
+
import { HlmLabel } from '@egose/shadcn-theme-ng/label';
|
|
7
|
+
import { HlmRadioGroup, HlmRadio, HlmRadioIndicator } from '@egose/shadcn-theme-ng/radio-group';
|
|
8
|
+
import { hlm } from '@egose/shadcn-theme-ng/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
|
+
_errorMessages = injectEgFormErrorMessages();
|
|
21
|
+
generatedId = inject(HlmFormIdGenerator).generate('eg-form-radio-group');
|
|
22
|
+
_config = injectEgFormRadioGroupConfig();
|
|
23
|
+
label = input(undefined, /* @ts-ignore */
|
|
24
|
+
...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
25
|
+
controlId = input(undefined, /* @ts-ignore */
|
|
26
|
+
...(ngDevMode ? [{ debugName: "controlId" }] : /* istanbul ignore next */ []));
|
|
27
|
+
controlName = input('', /* @ts-ignore */
|
|
28
|
+
...(ngDevMode ? [{ debugName: "controlName" }] : /* istanbul ignore next */ []));
|
|
29
|
+
error = input(undefined, /* @ts-ignore */
|
|
30
|
+
...(ngDevMode ? [{ debugName: "error" }] : /* istanbul ignore next */ []));
|
|
31
|
+
/**
|
|
32
|
+
* Auto-resolve the displayed message from the control's `ValidationErrors`
|
|
33
|
+
* when `error()` is unset. Explicit `error()` always wins. Set to `false`
|
|
34
|
+
* for manual-only messages.
|
|
35
|
+
*/
|
|
36
|
+
autoError = input(true, /* @ts-ignore */
|
|
37
|
+
...(ngDevMode ? [{ debugName: "autoError" }] : /* istanbul ignore next */ []));
|
|
38
|
+
hint = input(undefined, /* @ts-ignore */
|
|
39
|
+
...(ngDevMode ? [{ debugName: "hint" }] : /* istanbul ignore next */ []));
|
|
40
|
+
id = input(undefined, /* @ts-ignore */
|
|
41
|
+
...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
|
|
42
|
+
name = input(undefined, /* @ts-ignore */
|
|
43
|
+
...(ngDevMode ? [{ debugName: "name" }] : /* istanbul ignore next */ []));
|
|
44
|
+
disabled = input(false, /* @ts-ignore */
|
|
45
|
+
...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
46
|
+
required = input(false, /* @ts-ignore */
|
|
47
|
+
...(ngDevMode ? [{ debugName: "required" }] : /* istanbul ignore next */ []));
|
|
48
|
+
options = input([], /* @ts-ignore */
|
|
49
|
+
...(ngDevMode ? [{ debugName: "options" }] : /* istanbul ignore next */ []));
|
|
50
|
+
effectiveId = computed(() => this.controlId() || this.id() || this.generatedId, /* @ts-ignore */
|
|
51
|
+
...(ngDevMode ? [{ debugName: "effectiveId" }] : /* istanbul ignore next */ []));
|
|
52
|
+
errorId = computed(() => `${this.effectiveId()}-error`, /* @ts-ignore */
|
|
53
|
+
...(ngDevMode ? [{ debugName: "errorId" }] : /* istanbul ignore next */ []));
|
|
54
|
+
hintId = computed(() => `${this.effectiveId()}-hint`, /* @ts-ignore */
|
|
55
|
+
...(ngDevMode ? [{ debugName: "hintId" }] : /* istanbul ignore next */ []));
|
|
56
|
+
/**
|
|
57
|
+
* Displayed message: explicit `error()` wins; otherwise (when `autoError()`)
|
|
58
|
+
* auto-resolved from the control's `ValidationErrors`. Plain method (not a
|
|
59
|
+
* computed): `ValidationErrors` is not a signal, so the control must be read
|
|
60
|
+
* fresh on every change-detection pass.
|
|
61
|
+
*/
|
|
62
|
+
resolvedError() {
|
|
63
|
+
const explicit = this.error();
|
|
64
|
+
if (explicit)
|
|
65
|
+
return explicit;
|
|
66
|
+
if (!this.autoError())
|
|
67
|
+
return undefined;
|
|
68
|
+
const control = this.formGroupDirective.form.get(this.controlName());
|
|
69
|
+
return resolveEgFormError(control?.errors ?? null, this.label(), this._errorMessages);
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Whether the error is surfaced: message present + control invalid +
|
|
73
|
+
* touched/dirty/submitted. Gates the visual `<hlm-error>` (and
|
|
74
|
+
* `describedBy()`, where present) so sighted and screen-reader output agree.
|
|
75
|
+
*/
|
|
76
|
+
showError() {
|
|
77
|
+
const control = this.formGroupDirective.form.get(this.controlName());
|
|
78
|
+
return (!!this.resolvedError() &&
|
|
79
|
+
!!control?.invalid &&
|
|
80
|
+
(control.dirty || control.touched || this.formGroupDirective.submitted));
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Combined lock for the brain `linkedSignal`-based disabled state: the raw
|
|
84
|
+
* input write always carries the resolved value, so a same-pass
|
|
85
|
+
* wrapper-toggle + `control.disable()` cannot clobber CVA state.
|
|
86
|
+
*/
|
|
87
|
+
effectiveDisabled() {
|
|
88
|
+
return this.disabled() || !!this.formGroupDirective.form.get(this.controlName())?.disabled;
|
|
89
|
+
}
|
|
90
|
+
describedBy() {
|
|
91
|
+
return this.showError() ? this.errorId() : this.hint() ? this.hintId() : null;
|
|
92
|
+
}
|
|
93
|
+
// Styling
|
|
94
|
+
userClass = input('', { ...(ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {}), alias: 'class' });
|
|
95
|
+
labelClass = input('', /* @ts-ignore */
|
|
96
|
+
...(ngDevMode ? [{ debugName: "labelClass" }] : /* istanbul ignore next */ []));
|
|
97
|
+
groupClass = input('', /* @ts-ignore */
|
|
98
|
+
...(ngDevMode ? [{ debugName: "groupClass" }] : /* istanbul ignore next */ []));
|
|
99
|
+
errorClass = input('', /* @ts-ignore */
|
|
100
|
+
...(ngDevMode ? [{ debugName: "errorClass" }] : /* istanbul ignore next */ []));
|
|
101
|
+
hintClass = input('', /* @ts-ignore */
|
|
102
|
+
...(ngDevMode ? [{ debugName: "hintClass" }] : /* istanbul ignore next */ []));
|
|
103
|
+
// Computed classes (library base < global config < per-instance)
|
|
104
|
+
$userClass = computed(() => hlm("w-full", this.userClass()), /* @ts-ignore */
|
|
105
|
+
...(ngDevMode ? [{ debugName: "$userClass" }] : /* istanbul ignore next */ []));
|
|
106
|
+
$labelClass = computed(() => hlm("mb-1", this._config.labelClass, this.labelClass()), /* @ts-ignore */
|
|
107
|
+
...(ngDevMode ? [{ debugName: "$labelClass" }] : /* istanbul ignore next */ []));
|
|
108
|
+
$groupClass = computed(() => hlm("flex flex-col gap-2", this._config.groupClass, this.groupClass()), /* @ts-ignore */
|
|
109
|
+
...(ngDevMode ? [{ debugName: "$groupClass" }] : /* istanbul ignore next */ []));
|
|
110
|
+
$errorClass = computed(() => hlm("mt-0", this._config.errorClass, this.errorClass()), /* @ts-ignore */
|
|
111
|
+
...(ngDevMode ? [{ debugName: "$errorClass" }] : /* istanbul ignore next */ []));
|
|
112
|
+
$hintClass = computed(() => hlm("mt-0", this._config.hintClass, this.hintClass()), /* @ts-ignore */
|
|
113
|
+
...(ngDevMode ? [{ debugName: "$hintClass" }] : /* istanbul ignore next */ []));
|
|
114
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: EgFormRadioGroup, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
115
|
+
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 }, autoError: { classPropertyName: "autoError", publicName: "autoError", 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: "\n @let lbl = label();\n @let cnm = controlName();\n @let hnt = hint();\n @let rqrd = required();\n\n <hlm-form-field>\n @if (lbl) {\n <span hlmLabel [class]=\"$labelClass()\"\n >{{ lbl }}\n @if (rqrd) {\n <span class=\"text-red-500\">*</span>\n }\n </span>\n }\n\n <hlm-radio-group\n [formControlName]=\"cnm\"\n [name]=\"cnm || name() || ''\"\n [disabled]=\"effectiveDisabled()\"\n [required]=\"rqrd\"\n [class]=\"$groupClass()\"\n >\n @for (option of options(); track option.value) {\n <label class=\"flex items-center gap-2\">\n <hlm-radio\n [value]=\"option.value\"\n [disabled]=\"option.disabled ?? false\"\n [aria-describedby]=\"describedBy() ?? undefined\"\n >\n <hlm-radio-indicator />\n </hlm-radio>\n <span>{{ option.label }}</span>\n </label>\n }\n </hlm-radio-group>\n\n @if (showError()) {\n <hlm-error [id]=\"errorId()\" [class]=\"$errorClass()\">\n {{ resolvedError() }}\n </hlm-error>\n }\n\n @if (hnt) {\n <hlm-hint [id]=\"hintId()\" [class]=\"$hintClass()\">\n {{ hnt }}\n </hlm-hint>\n }\n </hlm-form-field>\n ", isInline: true, dependencies: [{ kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.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" }] });
|
|
116
|
+
}
|
|
117
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: EgFormRadioGroup, decorators: [{
|
|
118
|
+
type: Component,
|
|
119
|
+
args: [{
|
|
120
|
+
selector: 'eg-form-radio-group',
|
|
121
|
+
standalone: true,
|
|
122
|
+
host: {
|
|
123
|
+
'[class]': '$userClass()',
|
|
124
|
+
},
|
|
125
|
+
imports: [ReactiveFormsModule, HlmFormField, HlmError, HlmHint, HlmLabel, HlmRadioGroup, HlmRadio, HlmRadioIndicator],
|
|
126
|
+
providers: [{ provide: ControlContainer, useExisting: FormGroupDirective }],
|
|
127
|
+
template: "\n @let lbl = label();\n @let cnm = controlName();\n @let hnt = hint();\n @let rqrd = required();\n\n <hlm-form-field>\n @if (lbl) {\n <span hlmLabel [class]=\"$labelClass()\"\n >{{ lbl }}\n @if (rqrd) {\n <span class=\"text-red-500\">*</span>\n }\n </span>\n }\n\n <hlm-radio-group\n [formControlName]=\"cnm\"\n [name]=\"cnm || name() || ''\"\n [disabled]=\"effectiveDisabled()\"\n [required]=\"rqrd\"\n [class]=\"$groupClass()\"\n >\n @for (option of options(); track option.value) {\n <label class=\"flex items-center gap-2\">\n <hlm-radio\n [value]=\"option.value\"\n [disabled]=\"option.disabled ?? false\"\n [aria-describedby]=\"describedBy() ?? undefined\"\n >\n <hlm-radio-indicator />\n </hlm-radio>\n <span>{{ option.label }}</span>\n </label>\n }\n </hlm-radio-group>\n\n @if (showError()) {\n <hlm-error [id]=\"errorId()\" [class]=\"$errorClass()\">\n {{ resolvedError() }}\n </hlm-error>\n }\n\n @if (hnt) {\n <hlm-hint [id]=\"hintId()\" [class]=\"$hintClass()\">\n {{ hnt }}\n </hlm-hint>\n }\n </hlm-form-field>\n ",
|
|
128
|
+
}]
|
|
129
|
+
}], 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 }] }], autoError: [{ type: i0.Input, args: [{ isSignal: true, alias: "autoError", 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 }] }] } });
|
|
130
|
+
|
|
131
|
+
/*
|
|
132
|
+
* Public API Surface of form-radio-group
|
|
133
|
+
*/
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Generated bundle index. Do not edit.
|
|
137
|
+
*/
|
|
138
|
+
|
|
139
|
+
export { EgFormRadioGroup, injectEgFormRadioGroupConfig, provideEgFormRadioGroupConfig };
|
|
140
|
+
|
|
@@ -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,83 @@
|
|
|
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 _errorMessages;
|
|
13
|
+
private readonly generatedId;
|
|
14
|
+
private readonly _config;
|
|
15
|
+
label: _angular_core.InputSignal<string | undefined>;
|
|
16
|
+
controlId: _angular_core.InputSignal<string | undefined>;
|
|
17
|
+
controlName: _angular_core.InputSignal<string>;
|
|
18
|
+
error: _angular_core.InputSignal<string | undefined>;
|
|
19
|
+
/**
|
|
20
|
+
* Auto-resolve the displayed message from the control's `ValidationErrors`
|
|
21
|
+
* when `error()` is unset. Explicit `error()` always wins. Set to `false`
|
|
22
|
+
* for manual-only messages.
|
|
23
|
+
*/
|
|
24
|
+
autoError: _angular_core.InputSignal<boolean>;
|
|
25
|
+
hint: _angular_core.InputSignal<string | undefined>;
|
|
26
|
+
id: _angular_core.InputSignal<string | undefined>;
|
|
27
|
+
name: _angular_core.InputSignal<string | undefined>;
|
|
28
|
+
disabled: _angular_core.InputSignal<boolean>;
|
|
29
|
+
required: _angular_core.InputSignal<boolean>;
|
|
30
|
+
options: _angular_core.InputSignal<RadioOption[]>;
|
|
31
|
+
readonly effectiveId: _angular_core.Signal<string>;
|
|
32
|
+
readonly errorId: _angular_core.Signal<string>;
|
|
33
|
+
readonly hintId: _angular_core.Signal<string>;
|
|
34
|
+
/**
|
|
35
|
+
* Displayed message: explicit `error()` wins; otherwise (when `autoError()`)
|
|
36
|
+
* auto-resolved from the control's `ValidationErrors`. Plain method (not a
|
|
37
|
+
* computed): `ValidationErrors` is not a signal, so the control must be read
|
|
38
|
+
* fresh on every change-detection pass.
|
|
39
|
+
*/
|
|
40
|
+
protected resolvedError(): string | undefined;
|
|
41
|
+
/**
|
|
42
|
+
* Whether the error is surfaced: message present + control invalid +
|
|
43
|
+
* touched/dirty/submitted. Gates the visual `<hlm-error>` (and
|
|
44
|
+
* `describedBy()`, where present) so sighted and screen-reader output agree.
|
|
45
|
+
*/
|
|
46
|
+
protected showError(): boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Combined lock for the brain `linkedSignal`-based disabled state: the raw
|
|
49
|
+
* input write always carries the resolved value, so a same-pass
|
|
50
|
+
* wrapper-toggle + `control.disable()` cannot clobber CVA state.
|
|
51
|
+
*/
|
|
52
|
+
effectiveDisabled(): boolean;
|
|
53
|
+
describedBy(): string | null;
|
|
54
|
+
userClass: _angular_core.InputSignal<ClassValue>;
|
|
55
|
+
labelClass: _angular_core.InputSignal<string>;
|
|
56
|
+
groupClass: _angular_core.InputSignal<string>;
|
|
57
|
+
errorClass: _angular_core.InputSignal<string>;
|
|
58
|
+
hintClass: _angular_core.InputSignal<string>;
|
|
59
|
+
$userClass: _angular_core.Signal<string>;
|
|
60
|
+
$labelClass: _angular_core.Signal<string>;
|
|
61
|
+
$groupClass: _angular_core.Signal<string>;
|
|
62
|
+
$errorClass: _angular_core.Signal<string>;
|
|
63
|
+
$hintClass: _angular_core.Signal<string>;
|
|
64
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<EgFormRadioGroup, never>;
|
|
65
|
+
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; }; "autoError": { "alias": "autoError"; "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>;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
interface EgFormRadioGroupConfig {
|
|
69
|
+
/**
|
|
70
|
+
* Global class defaults for `eg-form-radio-group` styling slots.
|
|
71
|
+
* Each is merged under the matching per-instance `*Class` input
|
|
72
|
+
* (library base < global config < per-instance).
|
|
73
|
+
*/
|
|
74
|
+
labelClass?: string;
|
|
75
|
+
groupClass?: string;
|
|
76
|
+
errorClass?: string;
|
|
77
|
+
hintClass?: string;
|
|
78
|
+
}
|
|
79
|
+
declare function provideEgFormRadioGroupConfig(config: Partial<EgFormRadioGroupConfig>): ValueProvider;
|
|
80
|
+
declare function injectEgFormRadioGroupConfig(): EgFormRadioGroupConfig;
|
|
81
|
+
|
|
82
|
+
export { EgFormRadioGroup, injectEgFormRadioGroupConfig, provideEgFormRadioGroupConfig };
|
|
83
|
+
export type { EgFormRadioGroupConfig };
|
|
@@ -77,23 +77,24 @@ Real selectors involved: `eg-form-searchable-multiselect` (this wrapper), `eg-fo
|
|
|
77
77
|
|
|
78
78
|
### `eg-form-searchable-multiselect` — `EgFormSearchableMultiselect`
|
|
79
79
|
|
|
80
|
-
| Input | Type | Default | Description
|
|
81
|
-
| --------------------- | --------------------- | ------------------------ |
|
|
82
|
-
| `label` | `string \| undefined` | `undefined` | Field label. When set, a `<label hlmLabel>` bound to the control id is rendered.
|
|
83
|
-
| `controlName` | `string` | `''` | **Required.** Name of the control in the parent `FormGroup`; forwarded as `formControlName`.
|
|
84
|
-
| `controlId` | `string \| undefined` | `undefined` | Explicit control id. Falls back to `id`, then to a generated `eg-form-searchable-multiselect-…` id.
|
|
85
|
-
| `id` | `string \| undefined` | `undefined` | Alias for an explicit control id (same fallback chain as `controlId`).
|
|
86
|
-
| `error` | `string \| undefined` | `undefined` | Error text rendered in `<hlm-error>`.
|
|
87
|
-
| `
|
|
88
|
-
| `
|
|
89
|
-
| `
|
|
90
|
-
| `
|
|
91
|
-
| `
|
|
92
|
-
| `
|
|
93
|
-
| `
|
|
94
|
-
| `
|
|
95
|
-
| `
|
|
96
|
-
| `
|
|
80
|
+
| Input | Type | Default | Description |
|
|
81
|
+
| --------------------- | --------------------- | ------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
82
|
+
| `label` | `string \| undefined` | `undefined` | Field label. When set, a `<label hlmLabel>` bound to the control id is rendered. |
|
|
83
|
+
| `controlName` | `string` | `''` | **Required.** Name of the control in the parent `FormGroup`; forwarded as `formControlName`. |
|
|
84
|
+
| `controlId` | `string \| undefined` | `undefined` | Explicit control id. Falls back to `id`, then to a generated `eg-form-searchable-multiselect-…` id. |
|
|
85
|
+
| `id` | `string \| undefined` | `undefined` | Alias for an explicit control id (same fallback chain as `controlId`). |
|
|
86
|
+
| `error` | `string \| undefined` | `undefined` | Error text rendered in `<hlm-error>`. |
|
|
87
|
+
| `autoError` | `boolean` | `true` | Auto-resolve the message from the control's `ValidationErrors` when `error` is unset. Explicit `error` always wins; `error=""` counts as unset. Global wording via `provideEgFormErrorMessages`. |
|
|
88
|
+
| `hint` | `string \| undefined` | `undefined` | Hint text rendered in `<hlm-hint>`. |
|
|
89
|
+
| `placeholder` | `string` | `'Start typing to add…'` | Placeholder forwarded to the inner multiselect. |
|
|
90
|
+
| `disabled` | `boolean` | `false` | Wrapper-level disable, forwarded as `wrapperDisabled` to the inner multiselect. |
|
|
91
|
+
| `required` | `boolean` | `false` | Adds `required` to the inner control and renders a red `*` next to the label. |
|
|
92
|
+
| `options` | `SelectOption[]` | `[]` | `{ label: string; value: string }[]` forwarded to the inner multiselect. |
|
|
93
|
+
| `class` (`userClass`) | `ClassValue` | `''` | Extra classes for the host (merged over `tw:w-full`). |
|
|
94
|
+
| `labelClass` | `string` | `''` | Extra classes for the `<label>` (merged over `tw:mb-1 tw:gap-0`). |
|
|
95
|
+
| `controlClass` | `string` | `''` | Extra classes for the inner multiselect (merged over `tw:w-full`). |
|
|
96
|
+
| `errorClass` | `string` | `''` | Extra classes for `<hlm-error>` (merged over `tw:mt-0`). |
|
|
97
|
+
| `hintClass` | `string` | `''` | Extra classes for `<hlm-hint>` (merged over `tw:mt-0`). |
|
|
97
98
|
|
|
98
99
|
No outputs. Readonly computeds/methods (usable via template ref): `effectiveId()`, `errorId()` (`<id>-error`), `hintId()` (`<id>-hint`), `describedBy(): string | null` (returns the error id when the control is invalid + dirty/touched, else the hint id, else `null`).
|
|
99
100
|
|
|
@@ -354,6 +355,16 @@ export class ProgrammaticExample {
|
|
|
354
355
|
|
|
355
356
|
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
357
|
|
|
358
|
+
Global defaults per styling slot via the wrapper config (precedence: library base < global config < per-instance):
|
|
359
|
+
|
|
360
|
+
```ts
|
|
361
|
+
import { provideEgFormSearchableMultiselectConfig } from '@egose/shadcn-theme-ng/form-searchable-multiselect';
|
|
362
|
+
|
|
363
|
+
await bootstrapApplication(App, {
|
|
364
|
+
providers: [provideEgFormSearchableMultiselectConfig({ controlClass: 'tw:text-sm', labelClass: 'tw:font-medium' })],
|
|
365
|
+
});
|
|
366
|
+
```
|
|
367
|
+
|
|
357
368
|
## Related subpaths
|
|
358
369
|
|
|
359
370
|
- `@egose/shadcn-theme-ng/searchable-multiselect` — the underlying `EgSearchableMultiselect` + `SelectOption` (use it directly for template-driven or non-form usage).
|