@egose/shadcn-theme-ng-tw 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/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 +178 -0
- package/form-autocomplete/fesm2022/form-autocomplete.mjs +243 -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 +62 -22
- package/form-checkbox/types/form-checkbox.d.ts +43 -4
- package/form-combobox/README.md +203 -0
- package/form-combobox/fesm2022/form-combobox.mjs +305 -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 +100 -29
- 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 +266 -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 +263 -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 +226 -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 +256 -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 +226 -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 +230 -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 +238 -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 +60 -24
- 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 +65 -29
- package/form-select/types/form-select.d.ts +39 -2
- package/form-slider/README.md +183 -0
- package/form-slider/fesm2022/form-slider.mjs +218 -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 +205 -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 +60 -24
- 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 +60 -24
- package/form-textarea/types/form-textarea.d.ts +39 -2
- package/form-toggle/README.md +187 -0
- package/form-toggle/fesm2022/form-toggle.mjs +275 -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 +243 -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 +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,174 @@
|
|
|
1
|
+
# Form Switch (`@egose/shadcn-theme-ng/form-switch`)
|
|
2
|
+
|
|
3
|
+
A ready-made reactive-form boolean field: `hlm-switch` + label + validation error/hint display in one tag. The switch equivalent of `eg-form-checkbox` for on/off settings.
|
|
4
|
+
|
|
5
|
+
The Angular implementation is a standalone wrapper: it renders `EgFormField` from `@egose/shadcn-theme-ng/form-field-simple` (like `eg-form-checkbox`, because `hlm-switch` exposes no `BrnFieldControl`), `HlmError` / `HlmHint`, `HlmLabel`, and `HlmSwitch` from `@egose/shadcn-theme-ng/switch`. The inner switch is bound with `[formControlName]="controlName()"`, so the parent `FormGroup` owns the `boolean` value. It must live inside a `FormGroupDirective` (`[formGroup]` parent); ids come from `HlmFormIdGenerator` unless overridden.
|
|
6
|
+
|
|
7
|
+
> **Ships as:** `@egose/shadcn-theme-ng/form-switch` and `@egose/shadcn-theme-ng-tw/form-switch`
|
|
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/switch`, `@egose/shadcn-theme-ng/form-field`, `@egose/shadcn-theme-ng/form-field-simple`, and
|
|
25
|
+
`@egose/shadcn-theme-ng/label`.
|
|
26
|
+
|
|
27
|
+
## Imports
|
|
28
|
+
|
|
29
|
+
Exported from the subpath root (`projects/form-switch/src/public-api.ts`):
|
|
30
|
+
|
|
31
|
+
```ts
|
|
32
|
+
import { EgFormSwitch, provideEgFormSwitchConfig } from '@egose/shadcn-theme-ng/form-switch';
|
|
33
|
+
// tw variant: replace with '@egose/shadcn-theme-ng-tw/form-switch'
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Standalone usage:
|
|
37
|
+
|
|
38
|
+
```ts
|
|
39
|
+
import { Component } from '@angular/core';
|
|
40
|
+
import { ReactiveFormsModule } from '@angular/forms';
|
|
41
|
+
import { EgFormSwitch } from '@egose/shadcn-theme-ng/form-switch';
|
|
42
|
+
|
|
43
|
+
@Component({
|
|
44
|
+
selector: 'app-demo',
|
|
45
|
+
standalone: true,
|
|
46
|
+
imports: [ReactiveFormsModule, EgFormSwitch],
|
|
47
|
+
template: `...`,
|
|
48
|
+
})
|
|
49
|
+
export class DemoComponent {}
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
NgModule-based consumer: add `EgFormSwitch` (and `ReactiveFormsModule`) to the module's
|
|
53
|
+
`imports` — it is a standalone component, not a module.
|
|
54
|
+
|
|
55
|
+
`ControlValueAccessor` behavior: `eg-form-switch` itself is not a `ControlValueAccessor`; the
|
|
56
|
+
inner `hlm-switch` 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-switch controlName="notifications" label="Email notifications" hint="Toggle to subscribe." />
|
|
64
|
+
</form>
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Selector (from source): `eg-form-switch` (standalone component, host `tw:w-full`).
|
|
68
|
+
|
|
69
|
+
## API reference
|
|
70
|
+
|
|
71
|
+
### `EgFormSwitch` — `eg-form-switch`
|
|
72
|
+
|
|
73
|
+
| Input | Type | Default | Description |
|
|
74
|
+
| ------------- | --------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
75
|
+
| `controlName` | `string` | `''` | `formControlName` key inside the parent `FormGroup`. **Required.** |
|
|
76
|
+
| `label` | `string \| undefined` | — | Label text beside the switch (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 (first priority for `effectiveId`). |
|
|
81
|
+
| `id` | `string \| undefined` | — | Fallback id (second priority). |
|
|
82
|
+
| `disabled` | `boolean` | `false` | Locks interaction (form control stays enabled). |
|
|
83
|
+
| `required` | `boolean` | `false` | Shows a red `*` next to the label; forwarded to the switch. |
|
|
84
|
+
| `class` | `ClassValue` | `''` | Extra host classes (base `tw:w-full`). |
|
|
85
|
+
| `switchClass` | `string` | `''` | Extra switch classes, merged into `HlmSwitch.userClass`. |
|
|
86
|
+
| `labelClass` | `string` | `''` | Extra label classes. |
|
|
87
|
+
| `errorClass` | `string` | `''` | Extra error classes (base `tw:mt-0`). |
|
|
88
|
+
| `hintClass` | `string` | `''` | Extra hint classes (base `tw:mt-0`). |
|
|
89
|
+
|
|
90
|
+
| Member | Description |
|
|
91
|
+
| -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
92
|
+
| `effectiveId` | `controlId() \|\| id() \|\| generated` — wired to switch `id` and label `for`. |
|
|
93
|
+
| `errorId` / `hintId` | `effectiveId + '-error' / '-hint'`. |
|
|
94
|
+
| `describedBy()` | `errorId` when `error()` is set and control is invalid + dirty/touched, else `hintId` when `hint()` is set, else `null` — wired to switch `aria-describedby`. |
|
|
95
|
+
|
|
96
|
+
Requires a `[formGroup]` ancestor (injects `FormGroupDirective`, provides `ControlContainer → FormGroupDirective`).
|
|
97
|
+
|
|
98
|
+
## Examples
|
|
99
|
+
|
|
100
|
+
### 1. Basic settings toggle
|
|
101
|
+
|
|
102
|
+
```ts
|
|
103
|
+
import { Component, inject } from '@angular/core';
|
|
104
|
+
import { FormBuilder, ReactiveFormsModule } from '@angular/forms';
|
|
105
|
+
import { EgFormSwitch } from '@egose/shadcn-theme-ng/form-switch';
|
|
106
|
+
|
|
107
|
+
@Component({
|
|
108
|
+
selector: 'app-settings',
|
|
109
|
+
standalone: true,
|
|
110
|
+
imports: [ReactiveFormsModule, EgFormSwitch],
|
|
111
|
+
template: `
|
|
112
|
+
<form [formGroup]="form">
|
|
113
|
+
<eg-form-switch controlName="notifications" label="Email notifications" hint="Toggle to subscribe." />
|
|
114
|
+
</form>
|
|
115
|
+
`,
|
|
116
|
+
})
|
|
117
|
+
export class SettingsComponent {
|
|
118
|
+
private readonly fb = inject(FormBuilder);
|
|
119
|
+
readonly form = this.fb.group({ notifications: [true] });
|
|
120
|
+
}
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### 2. Required opt-in with error
|
|
124
|
+
|
|
125
|
+
```ts
|
|
126
|
+
import { Component, inject } from '@angular/core';
|
|
127
|
+
import { FormBuilder, ReactiveFormsModule, Validators } from '@angular/forms';
|
|
128
|
+
import { EgFormSwitch } from '@egose/shadcn-theme-ng/form-switch';
|
|
129
|
+
|
|
130
|
+
@Component({
|
|
131
|
+
selector: 'app-consent',
|
|
132
|
+
standalone: true,
|
|
133
|
+
imports: [ReactiveFormsModule, EgFormSwitch],
|
|
134
|
+
template: `
|
|
135
|
+
<form [formGroup]="form" (ngSubmit)="submit()">
|
|
136
|
+
<eg-form-switch controlName="consent" label="I accept the terms" [required]="true" error="Consent is required." />
|
|
137
|
+
<button type="submit" [disabled]="form.invalid">Continue</button>
|
|
138
|
+
</form>
|
|
139
|
+
`,
|
|
140
|
+
})
|
|
141
|
+
export class ConsentComponent {
|
|
142
|
+
private readonly fb = inject(FormBuilder);
|
|
143
|
+
readonly form = this.fb.group({ consent: [false, Validators.requiredTrue] });
|
|
144
|
+
submit() {
|
|
145
|
+
console.log(this.form.value.consent);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
## Accessibility notes
|
|
151
|
+
|
|
152
|
+
- Label `for` ↔ switch `id` wiring is automatic via `effectiveId`; the switch also receives `aria-describedby` (error/hint id) — always pass a `label`.
|
|
153
|
+
- The required `*` is visual; pair with `Validators.requiredTrue` so assistive tech and validation agree.
|
|
154
|
+
|
|
155
|
+
## Theming / CSS variables
|
|
156
|
+
|
|
157
|
+
No component-specific CSS variables. Style per-instance via `class` / `switchClass` / `labelClass` / `errorClass` / `hintClass` (precedence: library base < global config < per-instance). The row layout (`flex items-center gap-1`) is fixed in the template.
|
|
158
|
+
|
|
159
|
+
Global defaults per styling slot via the wrapper config:
|
|
160
|
+
|
|
161
|
+
```ts
|
|
162
|
+
import { provideEgFormSwitchConfig } from '@egose/shadcn-theme-ng/form-switch';
|
|
163
|
+
|
|
164
|
+
await bootstrapApplication(App, {
|
|
165
|
+
providers: [provideEgFormSwitchConfig({ labelClass: 'tw:font-medium' })],
|
|
166
|
+
});
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
## Related subpaths
|
|
170
|
+
|
|
171
|
+
- `@egose/shadcn-theme-ng/switch` — raw `hlm-switch` for custom layouts.
|
|
172
|
+
- `@egose/shadcn-theme-ng/form-checkbox` — the checkbox counterpart (`eg-form-checkbox`).
|
|
173
|
+
- `@egose/shadcn-theme-ng/form-field` — `hlm-error` / `hlm-hint` used internally.
|
|
174
|
+
- `@egose/shadcn-theme-ng/form-field-simple` — `eg-form-field` used internally.
|
|
@@ -0,0 +1,205 @@
|
|
|
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, HlmError, HlmHint } from '@egose/shadcn-theme-ng-tw/form-field';
|
|
6
|
+
import { EgFormField } from '@egose/shadcn-theme-ng-tw/form-field-simple';
|
|
7
|
+
import { HlmLabel } from '@egose/shadcn-theme-ng-tw/label';
|
|
8
|
+
import { HlmSwitch } from '@egose/shadcn-theme-ng-tw/switch';
|
|
9
|
+
import { hlm } from '@egose/shadcn-theme-ng-tw/utils';
|
|
10
|
+
|
|
11
|
+
const EgFormSwitchConfigToken = new InjectionToken('EgFormSwitchConfig');
|
|
12
|
+
function provideEgFormSwitchConfig(config) {
|
|
13
|
+
return { provide: EgFormSwitchConfigToken, useValue: { ...config } };
|
|
14
|
+
}
|
|
15
|
+
function injectEgFormSwitchConfig() {
|
|
16
|
+
return inject(EgFormSwitchConfigToken, { optional: true }) ?? {};
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
class EgFormSwitch {
|
|
20
|
+
formGroupDirective = inject(FormGroupDirective);
|
|
21
|
+
_errorMessages = injectEgFormErrorMessages();
|
|
22
|
+
generatedId = inject(HlmFormIdGenerator).generate('eg-form-switch');
|
|
23
|
+
_config = injectEgFormSwitchConfig();
|
|
24
|
+
label = input(undefined, /* @ts-ignore */
|
|
25
|
+
...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
26
|
+
controlId = input(undefined, /* @ts-ignore */
|
|
27
|
+
...(ngDevMode ? [{ debugName: "controlId" }] : /* istanbul ignore next */ []));
|
|
28
|
+
controlName = input('', /* @ts-ignore */
|
|
29
|
+
...(ngDevMode ? [{ debugName: "controlName" }] : /* istanbul ignore next */ []));
|
|
30
|
+
error = input(undefined, /* @ts-ignore */
|
|
31
|
+
...(ngDevMode ? [{ debugName: "error" }] : /* istanbul ignore next */ []));
|
|
32
|
+
/**
|
|
33
|
+
* Auto-resolve the displayed message from the control's `ValidationErrors`
|
|
34
|
+
* when `error()` is unset. Explicit `error()` always wins. Set to `false`
|
|
35
|
+
* for manual-only messages.
|
|
36
|
+
*/
|
|
37
|
+
autoError = input(true, /* @ts-ignore */
|
|
38
|
+
...(ngDevMode ? [{ debugName: "autoError" }] : /* istanbul ignore next */ []));
|
|
39
|
+
hint = input(undefined, /* @ts-ignore */
|
|
40
|
+
...(ngDevMode ? [{ debugName: "hint" }] : /* istanbul ignore next */ []));
|
|
41
|
+
id = input(undefined, /* @ts-ignore */
|
|
42
|
+
...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
|
|
43
|
+
disabled = input(false, /* @ts-ignore */
|
|
44
|
+
...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
45
|
+
required = input(false, /* @ts-ignore */
|
|
46
|
+
...(ngDevMode ? [{ debugName: "required" }] : /* istanbul ignore next */ []));
|
|
47
|
+
effectiveId = computed(() => this.controlId() || this.id() || this.generatedId, /* @ts-ignore */
|
|
48
|
+
...(ngDevMode ? [{ debugName: "effectiveId" }] : /* istanbul ignore next */ []));
|
|
49
|
+
errorId = computed(() => `${this.effectiveId()}-error`, /* @ts-ignore */
|
|
50
|
+
...(ngDevMode ? [{ debugName: "errorId" }] : /* istanbul ignore next */ []));
|
|
51
|
+
hintId = computed(() => `${this.effectiveId()}-hint`, /* @ts-ignore */
|
|
52
|
+
...(ngDevMode ? [{ debugName: "hintId" }] : /* istanbul ignore next */ []));
|
|
53
|
+
/**
|
|
54
|
+
* Displayed message: explicit `error()` wins; otherwise (when `autoError()`)
|
|
55
|
+
* auto-resolved from the control's `ValidationErrors`. Plain method (not a
|
|
56
|
+
* computed): `ValidationErrors` is not a signal, so the control must be read
|
|
57
|
+
* fresh on every change-detection pass.
|
|
58
|
+
*/
|
|
59
|
+
resolvedError() {
|
|
60
|
+
const explicit = this.error();
|
|
61
|
+
if (explicit)
|
|
62
|
+
return explicit;
|
|
63
|
+
if (!this.autoError())
|
|
64
|
+
return undefined;
|
|
65
|
+
const control = this.formGroupDirective.form.get(this.controlName());
|
|
66
|
+
return resolveEgFormError(control?.errors ?? null, this.label(), this._errorMessages);
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Whether the error is surfaced: message present + control invalid +
|
|
70
|
+
* touched/dirty/submitted. Gates the visual `<hlm-error>` (and
|
|
71
|
+
* `describedBy()`, where present) so sighted and screen-reader output agree.
|
|
72
|
+
*/
|
|
73
|
+
showError() {
|
|
74
|
+
const control = this.formGroupDirective.form.get(this.controlName());
|
|
75
|
+
return (!!this.resolvedError() &&
|
|
76
|
+
!!control?.invalid &&
|
|
77
|
+
(control.dirty || control.touched || this.formGroupDirective.submitted));
|
|
78
|
+
}
|
|
79
|
+
describedBy() {
|
|
80
|
+
return this.showError() ? this.errorId() : this.hint() ? this.hintId() : null;
|
|
81
|
+
}
|
|
82
|
+
// Styling
|
|
83
|
+
userClass = input('', { ...(ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {}), alias: 'class' });
|
|
84
|
+
switchClass = input('', /* @ts-ignore */
|
|
85
|
+
...(ngDevMode ? [{ debugName: "switchClass" }] : /* istanbul ignore next */ []));
|
|
86
|
+
labelClass = input('', /* @ts-ignore */
|
|
87
|
+
...(ngDevMode ? [{ debugName: "labelClass" }] : /* istanbul ignore next */ []));
|
|
88
|
+
errorClass = input('', /* @ts-ignore */
|
|
89
|
+
...(ngDevMode ? [{ debugName: "errorClass" }] : /* istanbul ignore next */ []));
|
|
90
|
+
hintClass = input('', /* @ts-ignore */
|
|
91
|
+
...(ngDevMode ? [{ debugName: "hintClass" }] : /* istanbul ignore next */ []));
|
|
92
|
+
// Computed classes (library base < global config < per-instance)
|
|
93
|
+
$userClass = computed(() => hlm('tw:w-full', this.userClass()), /* @ts-ignore */
|
|
94
|
+
...(ngDevMode ? [{ debugName: "$userClass" }] : /* istanbul ignore next */ []));
|
|
95
|
+
$switchClass = computed(() => hlm(this._config.switchClass, this.switchClass()), /* @ts-ignore */
|
|
96
|
+
...(ngDevMode ? [{ debugName: "$switchClass" }] : /* istanbul ignore next */ []));
|
|
97
|
+
$labelClass = computed(() => hlm(this._config.labelClass, this.labelClass()), /* @ts-ignore */
|
|
98
|
+
...(ngDevMode ? [{ debugName: "$labelClass" }] : /* istanbul ignore next */ []));
|
|
99
|
+
$errorClass = computed(() => hlm('tw:mt-0', this._config.errorClass, this.errorClass()), /* @ts-ignore */
|
|
100
|
+
...(ngDevMode ? [{ debugName: "$errorClass" }] : /* istanbul ignore next */ []));
|
|
101
|
+
$hintClass = computed(() => hlm('tw:mt-0', this._config.hintClass, this.hintClass()), /* @ts-ignore */
|
|
102
|
+
...(ngDevMode ? [{ debugName: "$hintClass" }] : /* istanbul ignore next */ []));
|
|
103
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: EgFormSwitch, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
104
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.3", type: EgFormSwitch, isStandalone: true, selector: "eg-form-switch", 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 }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, userClass: { classPropertyName: "userClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, switchClass: { classPropertyName: "switchClass", publicName: "switchClass", isSignal: true, isRequired: false, transformFunction: null }, labelClass: { classPropertyName: "labelClass", publicName: "labelClass", isSignal: true, isRequired: false, transformFunction: null }, errorClass: { classPropertyName: "errorClass", publicName: "errorClass", isSignal: true, isRequired: false, transformFunction: null }, hintClass: { classPropertyName: "hintClass", publicName: "hintClass", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "$userClass()" } }, providers: [{ provide: ControlContainer, useExisting: FormGroupDirective }], ngImport: i0, template: `
|
|
105
|
+
@let lbl = label();
|
|
106
|
+
@let cnm = controlName();
|
|
107
|
+
@let hnt = hint();
|
|
108
|
+
@let rqrd = required();
|
|
109
|
+
|
|
110
|
+
<eg-form-field>
|
|
111
|
+
<div class="tw:flex tw:items-center tw:gap-1">
|
|
112
|
+
<hlm-switch
|
|
113
|
+
[id]="effectiveId()"
|
|
114
|
+
[formControlName]="cnm"
|
|
115
|
+
[required]="rqrd"
|
|
116
|
+
[disabled]="disabled()"
|
|
117
|
+
[aria-describedby]="describedBy()"
|
|
118
|
+
[class]="$switchClass()"
|
|
119
|
+
/>
|
|
120
|
+
@if (lbl) {
|
|
121
|
+
<label hlmLabel [for]="effectiveId()" [class]="$labelClass()"
|
|
122
|
+
>{{ lbl }}
|
|
123
|
+
@if (rqrd) {
|
|
124
|
+
<span class="tw:text-red-500">*</span>
|
|
125
|
+
}
|
|
126
|
+
</label>
|
|
127
|
+
}
|
|
128
|
+
</div>
|
|
129
|
+
|
|
130
|
+
@if (showError()) {
|
|
131
|
+
<hlm-error [id]="errorId()" [class]="$errorClass()">
|
|
132
|
+
{{ resolvedError() }}
|
|
133
|
+
</hlm-error>
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
@if (hnt) {
|
|
137
|
+
<hlm-hint [id]="hintId()" [class]="$hintClass()">
|
|
138
|
+
{{ hnt }}
|
|
139
|
+
</hlm-hint>
|
|
140
|
+
}
|
|
141
|
+
</eg-form-field>
|
|
142
|
+
`, 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: "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: "component", type: HlmSwitch, selector: "hlm-switch", inputs: ["class", "checked", "disabled", "id", "aria-label", "aria-labelledby", "aria-describedby"], outputs: ["checkedChange", "changed"] }, { kind: "component", type: EgFormField, selector: "eg-form-field", inputs: ["class"] }] });
|
|
143
|
+
}
|
|
144
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: EgFormSwitch, decorators: [{
|
|
145
|
+
type: Component,
|
|
146
|
+
args: [{
|
|
147
|
+
selector: 'eg-form-switch',
|
|
148
|
+
standalone: true,
|
|
149
|
+
host: {
|
|
150
|
+
'[class]': '$userClass()',
|
|
151
|
+
},
|
|
152
|
+
imports: [ReactiveFormsModule, HlmError, HlmHint, HlmLabel, HlmSwitch, EgFormField],
|
|
153
|
+
providers: [{ provide: ControlContainer, useExisting: FormGroupDirective }],
|
|
154
|
+
template: `
|
|
155
|
+
@let lbl = label();
|
|
156
|
+
@let cnm = controlName();
|
|
157
|
+
@let hnt = hint();
|
|
158
|
+
@let rqrd = required();
|
|
159
|
+
|
|
160
|
+
<eg-form-field>
|
|
161
|
+
<div class="tw:flex tw:items-center tw:gap-1">
|
|
162
|
+
<hlm-switch
|
|
163
|
+
[id]="effectiveId()"
|
|
164
|
+
[formControlName]="cnm"
|
|
165
|
+
[required]="rqrd"
|
|
166
|
+
[disabled]="disabled()"
|
|
167
|
+
[aria-describedby]="describedBy()"
|
|
168
|
+
[class]="$switchClass()"
|
|
169
|
+
/>
|
|
170
|
+
@if (lbl) {
|
|
171
|
+
<label hlmLabel [for]="effectiveId()" [class]="$labelClass()"
|
|
172
|
+
>{{ lbl }}
|
|
173
|
+
@if (rqrd) {
|
|
174
|
+
<span class="tw:text-red-500">*</span>
|
|
175
|
+
}
|
|
176
|
+
</label>
|
|
177
|
+
}
|
|
178
|
+
</div>
|
|
179
|
+
|
|
180
|
+
@if (showError()) {
|
|
181
|
+
<hlm-error [id]="errorId()" [class]="$errorClass()">
|
|
182
|
+
{{ resolvedError() }}
|
|
183
|
+
</hlm-error>
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
@if (hnt) {
|
|
187
|
+
<hlm-hint [id]="hintId()" [class]="$hintClass()">
|
|
188
|
+
{{ hnt }}
|
|
189
|
+
</hlm-hint>
|
|
190
|
+
}
|
|
191
|
+
</eg-form-field>
|
|
192
|
+
`,
|
|
193
|
+
}]
|
|
194
|
+
}], 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 }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }], userClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], switchClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "switchClass", required: false }] }], labelClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "labelClass", required: false }] }], errorClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "errorClass", required: false }] }], hintClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "hintClass", required: false }] }] } });
|
|
195
|
+
|
|
196
|
+
/*
|
|
197
|
+
* Public API Surface of form-switch
|
|
198
|
+
*/
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* Generated bundle index. Do not edit.
|
|
202
|
+
*/
|
|
203
|
+
|
|
204
|
+
export { EgFormSwitch, injectEgFormSwitchConfig, provideEgFormSwitchConfig };
|
|
205
|
+
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "form-switch",
|
|
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-switch.mjs",
|
|
13
|
+
"typings": "types/form-switch.d.ts",
|
|
14
|
+
"exports": {
|
|
15
|
+
"./package.json": {
|
|
16
|
+
"default": "./package.json"
|
|
17
|
+
},
|
|
18
|
+
".": {
|
|
19
|
+
"types": "./types/form-switch.d.ts",
|
|
20
|
+
"default": "./fesm2022/form-switch.mjs"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"type": "module"
|
|
24
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import * as _angular_core from '@angular/core';
|
|
2
|
+
import { ValueProvider } from '@angular/core';
|
|
3
|
+
import { ClassValue } from 'clsx';
|
|
4
|
+
|
|
5
|
+
declare class EgFormSwitch {
|
|
6
|
+
private readonly formGroupDirective;
|
|
7
|
+
private readonly _errorMessages;
|
|
8
|
+
private readonly generatedId;
|
|
9
|
+
private readonly _config;
|
|
10
|
+
label: _angular_core.InputSignal<string | undefined>;
|
|
11
|
+
controlId: _angular_core.InputSignal<string | undefined>;
|
|
12
|
+
controlName: _angular_core.InputSignal<string>;
|
|
13
|
+
error: _angular_core.InputSignal<string | undefined>;
|
|
14
|
+
/**
|
|
15
|
+
* Auto-resolve the displayed message from the control's `ValidationErrors`
|
|
16
|
+
* when `error()` is unset. Explicit `error()` always wins. Set to `false`
|
|
17
|
+
* for manual-only messages.
|
|
18
|
+
*/
|
|
19
|
+
autoError: _angular_core.InputSignal<boolean>;
|
|
20
|
+
hint: _angular_core.InputSignal<string | undefined>;
|
|
21
|
+
id: _angular_core.InputSignal<string | undefined>;
|
|
22
|
+
disabled: _angular_core.InputSignal<boolean>;
|
|
23
|
+
required: _angular_core.InputSignal<boolean>;
|
|
24
|
+
readonly effectiveId: _angular_core.Signal<string>;
|
|
25
|
+
readonly errorId: _angular_core.Signal<string>;
|
|
26
|
+
readonly hintId: _angular_core.Signal<string>;
|
|
27
|
+
/**
|
|
28
|
+
* Displayed message: explicit `error()` wins; otherwise (when `autoError()`)
|
|
29
|
+
* auto-resolved from the control's `ValidationErrors`. Plain method (not a
|
|
30
|
+
* computed): `ValidationErrors` is not a signal, so the control must be read
|
|
31
|
+
* fresh on every change-detection pass.
|
|
32
|
+
*/
|
|
33
|
+
protected resolvedError(): string | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* Whether the error is surfaced: message present + control invalid +
|
|
36
|
+
* touched/dirty/submitted. Gates the visual `<hlm-error>` (and
|
|
37
|
+
* `describedBy()`, where present) so sighted and screen-reader output agree.
|
|
38
|
+
*/
|
|
39
|
+
protected showError(): boolean;
|
|
40
|
+
describedBy(): string | null;
|
|
41
|
+
userClass: _angular_core.InputSignal<ClassValue>;
|
|
42
|
+
switchClass: _angular_core.InputSignal<string>;
|
|
43
|
+
labelClass: _angular_core.InputSignal<string>;
|
|
44
|
+
errorClass: _angular_core.InputSignal<string>;
|
|
45
|
+
hintClass: _angular_core.InputSignal<string>;
|
|
46
|
+
$userClass: _angular_core.Signal<string>;
|
|
47
|
+
$switchClass: _angular_core.Signal<string>;
|
|
48
|
+
$labelClass: _angular_core.Signal<string>;
|
|
49
|
+
$errorClass: _angular_core.Signal<string>;
|
|
50
|
+
$hintClass: _angular_core.Signal<string>;
|
|
51
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<EgFormSwitch, never>;
|
|
52
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<EgFormSwitch, "eg-form-switch", 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; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "required": { "alias": "required"; "required": false; "isSignal": true; }; "userClass": { "alias": "class"; "required": false; "isSignal": true; }; "switchClass": { "alias": "switchClass"; "required": false; "isSignal": true; }; "labelClass": { "alias": "labelClass"; "required": false; "isSignal": true; }; "errorClass": { "alias": "errorClass"; "required": false; "isSignal": true; }; "hintClass": { "alias": "hintClass"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
interface EgFormSwitchConfig {
|
|
56
|
+
/**
|
|
57
|
+
* Global class defaults for `eg-form-switch` styling slots.
|
|
58
|
+
* Each is merged under the matching per-instance `*Class` input
|
|
59
|
+
* (library base < global config < per-instance).
|
|
60
|
+
*/
|
|
61
|
+
switchClass?: string;
|
|
62
|
+
labelClass?: string;
|
|
63
|
+
errorClass?: string;
|
|
64
|
+
hintClass?: string;
|
|
65
|
+
}
|
|
66
|
+
declare function provideEgFormSwitchConfig(config: Partial<EgFormSwitchConfig>): ValueProvider;
|
|
67
|
+
declare function injectEgFormSwitchConfig(): EgFormSwitchConfig;
|
|
68
|
+
|
|
69
|
+
export { EgFormSwitch, injectEgFormSwitchConfig, provideEgFormSwitchConfig };
|
|
70
|
+
export type { EgFormSwitchConfig };
|
|
@@ -75,32 +75,33 @@ Real selectors: `eg-form-text-input`, `hlm-form-field`, `label[hlmLabel]`, `inpu
|
|
|
75
75
|
|
|
76
76
|
### `eg-form-text-input` — `EgFormTextInput`
|
|
77
77
|
|
|
78
|
-
| Input | Type | Default | Description
|
|
79
|
-
| --------------------- | -------------------------- | ----------- |
|
|
80
|
-
| `label` | `string \| undefined` | `undefined` | Field label rendered as `<label hlmLabel>` bound to the input id.
|
|
81
|
-
| `controlName` | `string` | `''` | **Required.** Control name in the parent `FormGroup`; forwarded as `formControlName` and `name`.
|
|
82
|
-
| `controlId` | `string \| undefined` | `undefined` | Explicit id; falls back to `id`, then generated `eg-form-text-input-…`.
|
|
83
|
-
| `id` | `string \| undefined` | `undefined` | Alias for an explicit id (same fallback chain).
|
|
84
|
-
| `error` | `string \| undefined` | `undefined` | Error text rendered in `<hlm-error>`.
|
|
85
|
-
| `
|
|
86
|
-
| `
|
|
87
|
-
| `
|
|
88
|
-
| `
|
|
89
|
-
| `
|
|
90
|
-
| `
|
|
91
|
-
| `
|
|
92
|
-
| `
|
|
93
|
-
| `
|
|
94
|
-
| `
|
|
95
|
-
| `
|
|
96
|
-
| `
|
|
97
|
-
| `
|
|
98
|
-
| `
|
|
99
|
-
| `
|
|
100
|
-
| `
|
|
101
|
-
| `
|
|
102
|
-
| `
|
|
103
|
-
| `
|
|
78
|
+
| Input | Type | Default | Description |
|
|
79
|
+
| --------------------- | -------------------------- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
80
|
+
| `label` | `string \| undefined` | `undefined` | Field label rendered as `<label hlmLabel>` bound to the input id. |
|
|
81
|
+
| `controlName` | `string` | `''` | **Required.** Control name in the parent `FormGroup`; forwarded as `formControlName` and `name`. |
|
|
82
|
+
| `controlId` | `string \| undefined` | `undefined` | Explicit id; falls back to `id`, then generated `eg-form-text-input-…`. |
|
|
83
|
+
| `id` | `string \| undefined` | `undefined` | Alias for an explicit id (same fallback chain). |
|
|
84
|
+
| `error` | `string \| undefined` | `undefined` | Error text rendered in `<hlm-error>`. |
|
|
85
|
+
| `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`. |
|
|
86
|
+
| `hint` | `string \| undefined` | `undefined` | Hint text rendered in `<hlm-hint>`. |
|
|
87
|
+
| `name` | `string \| undefined` | `undefined` | `name` attribute fallback when `controlName` is empty. |
|
|
88
|
+
| `type` | `string` | `'text'` | Native input `type` (`text`, `email`, `password`, `number`, `tel`, `url`, …). |
|
|
89
|
+
| `placeholder` | `string` | `''` | Placeholder text. |
|
|
90
|
+
| `readonly` | `boolean` | `false` | Native `readonly` attribute. |
|
|
91
|
+
| `disabled` | `boolean` | `false` | Wrapper-level disable (OR-ed with the reactive disabled state — see `effectiveDisabled()`). |
|
|
92
|
+
| `maxlength` | `string \| number \| null` | `null` | Native `maxlength`. |
|
|
93
|
+
| `minlength` | `string \| number \| null` | `null` | Native `minlength`. |
|
|
94
|
+
| `max` | `string \| number \| null` | `null` | Native `max` (number/date inputs). |
|
|
95
|
+
| `min` | `string \| number \| null` | `null` | Native `min` (number/date inputs). |
|
|
96
|
+
| `pattern` | `string \| RegExp` | `''` | Native `pattern` attribute. |
|
|
97
|
+
| `autocomplete` | `string \| undefined` | `undefined` | Native `autocomplete` (e.g. `email`, `current-password`). |
|
|
98
|
+
| `autofocus` | `boolean` | `false` | Native `autofocus`. |
|
|
99
|
+
| `required` | `boolean` | `false` | Native `required` + red `*` on the label. |
|
|
100
|
+
| `class` (`userClass`) | `ClassValue` | `''` | Extra host classes (merged over `tw:flex tw:flex-col`). |
|
|
101
|
+
| `labelClass` | `string` | `''` | Extra label classes (merged over `tw:mb-1 tw:gap-0`). |
|
|
102
|
+
| `inputClass` | `string` | `''` | Extra input classes (merged over `tw:mb-1`). |
|
|
103
|
+
| `errorClass` | `string` | `''` | Extra error classes (merged over `tw:mt-0`). |
|
|
104
|
+
| `hintClass` | `string` | `''` | Extra hint classes (merged over `tw:mt-0`). |
|
|
104
105
|
|
|
105
106
|
No outputs. Methods: `describedBy(): string | null` (error id when invalid + dirty/touched, else hint id, else `null`); `effectiveDisabled(): boolean` (`disabled()` OR the control's reactive disabled state — bound as the native `disabled` attribute). Readonly computeds: `effectiveId()`, `errorId()`, `hintId()`.
|
|
106
107
|
|
|
@@ -364,6 +365,16 @@ export class ProfileExample {
|
|
|
364
365
|
|
|
365
366
|
No component-specific CSS variables; the input look comes from the shared theme tokens consumed by `HlmInput`. Adjust density with `inputClass` (e.g. `tw:h-11`), label/error/hint spacing with their `*Class` inputs.
|
|
366
367
|
|
|
368
|
+
Global defaults per styling slot via the wrapper config (precedence: library base < global config < per-instance):
|
|
369
|
+
|
|
370
|
+
```ts
|
|
371
|
+
import { provideEgFormTextInputConfig } from '@egose/shadcn-theme-ng/form-text-input';
|
|
372
|
+
|
|
373
|
+
await bootstrapApplication(App, {
|
|
374
|
+
providers: [provideEgFormTextInputConfig({ inputClass: 'tw:text-sm', labelClass: 'tw:font-medium' })],
|
|
375
|
+
});
|
|
376
|
+
```
|
|
377
|
+
|
|
367
378
|
## Related subpaths
|
|
368
379
|
|
|
369
380
|
- `@egose/shadcn-theme-ng/input` — the raw `HlmInput` directive for non-form or template-driven inputs.
|