@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.
Files changed (97) hide show
  1. package/README.md +1 -1
  2. package/alert/fesm2022/alert.mjs +1 -1
  3. package/autocomplete/fesm2022/autocomplete.mjs +1 -1
  4. package/button/fesm2022/button.mjs +3 -3
  5. package/checkbox/fesm2022/checkbox.mjs +6 -7
  6. package/checkbox/types/checkbox.d.ts +1 -1
  7. package/combobox/fesm2022/combobox.mjs +1 -1
  8. package/date-picker/README.md +15 -11
  9. package/date-picker/fesm2022/date-picker.mjs +148 -30
  10. package/date-picker/types/date-picker.d.ts +102 -9
  11. package/form-autocomplete/README.md +178 -0
  12. package/form-autocomplete/fesm2022/form-autocomplete.mjs +243 -0
  13. package/form-autocomplete/package.json +24 -0
  14. package/form-autocomplete/types/form-autocomplete.d.ts +81 -0
  15. package/form-checkbox/README.md +29 -18
  16. package/form-checkbox/fesm2022/form-checkbox.mjs +62 -22
  17. package/form-checkbox/types/form-checkbox.d.ts +43 -4
  18. package/form-combobox/README.md +203 -0
  19. package/form-combobox/fesm2022/form-combobox.mjs +305 -0
  20. package/form-combobox/package.json +24 -0
  21. package/form-combobox/types/form-combobox.d.ts +93 -0
  22. package/form-date-picker/README.md +49 -22
  23. package/form-date-picker/fesm2022/form-date-picker.mjs +100 -29
  24. package/form-date-picker/types/form-date-picker.d.ts +37 -1
  25. package/form-date-picker-multi/README.md +192 -0
  26. package/form-date-picker-multi/fesm2022/form-date-picker-multi.mjs +266 -0
  27. package/form-date-picker-multi/package.json +24 -0
  28. package/form-date-picker-multi/types/form-date-picker-multi.d.ts +78 -0
  29. package/form-date-range-picker/README.md +254 -0
  30. package/form-date-range-picker/fesm2022/form-date-range-picker.mjs +263 -0
  31. package/form-date-range-picker/package.json +24 -0
  32. package/form-date-range-picker/types/form-date-range-picker.d.ts +75 -0
  33. package/form-field/README.md +9 -0
  34. package/form-field/fesm2022/form-field.mjs +80 -5
  35. package/form-field/types/form-field.d.ts +50 -2
  36. package/form-field-simple/fesm2022/form-field-simple.mjs +15 -1
  37. package/form-field-simple/types/form-field-simple.d.ts +9 -2
  38. package/form-input-otp/README.md +195 -0
  39. package/form-input-otp/fesm2022/form-input-otp.mjs +226 -0
  40. package/form-input-otp/package.json +24 -0
  41. package/form-input-otp/types/form-input-otp.d.ts +78 -0
  42. package/form-month-year-picker/README.md +189 -0
  43. package/form-month-year-picker/fesm2022/form-month-year-picker.mjs +256 -0
  44. package/form-month-year-picker/package.json +24 -0
  45. package/form-month-year-picker/types/form-month-year-picker.d.ts +73 -0
  46. package/form-native-select/README.md +206 -0
  47. package/form-native-select/fesm2022/form-native-select.mjs +226 -0
  48. package/form-native-select/package.json +24 -0
  49. package/form-native-select/types/form-native-select.d.ts +77 -0
  50. package/form-phone-input/README.md +189 -0
  51. package/form-phone-input/fesm2022/form-phone-input.mjs +230 -0
  52. package/form-phone-input/package.json +24 -0
  53. package/form-phone-input/types/form-phone-input.d.ts +78 -0
  54. package/form-radio-group/README.md +199 -0
  55. package/form-radio-group/fesm2022/form-radio-group.mjs +238 -0
  56. package/form-radio-group/package.json +24 -0
  57. package/form-radio-group/types/form-radio-group.d.ts +83 -0
  58. package/form-searchable-multiselect/README.md +28 -17
  59. package/form-searchable-multiselect/fesm2022/form-searchable-multiselect.mjs +60 -24
  60. package/form-searchable-multiselect/types/form-searchable-multiselect.d.ts +39 -2
  61. package/form-select/README.md +30 -19
  62. package/form-select/fesm2022/form-select.mjs +65 -29
  63. package/form-select/types/form-select.d.ts +39 -2
  64. package/form-slider/README.md +183 -0
  65. package/form-slider/fesm2022/form-slider.mjs +218 -0
  66. package/form-slider/package.json +24 -0
  67. package/form-slider/types/form-slider.d.ts +80 -0
  68. package/form-switch/README.md +174 -0
  69. package/form-switch/fesm2022/form-switch.mjs +205 -0
  70. package/form-switch/package.json +24 -0
  71. package/form-switch/types/form-switch.d.ts +70 -0
  72. package/form-text-input/README.md +37 -26
  73. package/form-text-input/fesm2022/form-text-input.mjs +60 -24
  74. package/form-text-input/types/form-text-input.d.ts +39 -2
  75. package/form-textarea/README.md +33 -22
  76. package/form-textarea/fesm2022/form-textarea.mjs +60 -24
  77. package/form-textarea/types/form-textarea.d.ts +39 -2
  78. package/form-toggle/README.md +187 -0
  79. package/form-toggle/fesm2022/form-toggle.mjs +275 -0
  80. package/form-toggle/package.json +24 -0
  81. package/form-toggle/types/form-toggle.d.ts +100 -0
  82. package/form-toggle-group/README.md +177 -0
  83. package/form-toggle-group/fesm2022/form-toggle-group.mjs +243 -0
  84. package/form-toggle-group/package.json +24 -0
  85. package/form-toggle-group/types/form-toggle-group.d.ts +85 -0
  86. package/input-group/fesm2022/input-group.mjs +20 -10
  87. package/input-group/types/input-group.d.ts +4 -1
  88. package/native-select/fesm2022/native-select.mjs +18 -6
  89. package/native-select/types/native-select.d.ts +7 -2
  90. package/package.json +57 -1
  91. package/phone-input/README.md +114 -0
  92. package/phone-input/fesm2022/phone-input.mjs +191 -0
  93. package/phone-input/package.json +24 -0
  94. package/phone-input/types/phone-input.d.ts +67 -0
  95. package/sheet/fesm2022/sheet.mjs +1 -1
  96. package/switch/fesm2022/switch.mjs +7 -5
  97. package/switch/types/switch.d.ts +2 -1
@@ -0,0 +1,183 @@
1
+ # Form Slider (`@egose/shadcn-theme-ng/form-slider`)
2
+
3
+ A ready-made reactive-form numeric field: label + `hlm-slider` + validation error/hint display in one tag. The model is a `number[]` (one entry per thumb), matching `BrnSlider`.
4
+
5
+ The Angular implementation is a standalone wrapper: it renders `HlmFormField` / `HlmError` / `HlmHint` from `@egose/shadcn-theme-ng/form-field`, `HlmLabel`, and `HlmSlider` from `@egose/shadcn-theme-ng/slider`. The slider is bound with `[formControlName]="controlName()"`, so the parent `FormGroup` owns the value. It must live inside a `FormGroupDirective` (`[formGroup]` parent); ids come from `HlmFormIdGenerator` unless overridden.
6
+
7
+ > **Ships as:** `@egose/shadcn-theme-ng/form-slider` and `@egose/shadcn-theme-ng-tw/form-slider`
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/slider`, `@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-slider/src/public-api.ts`):
30
+
31
+ ```ts
32
+ import { EgFormSlider, provideEgFormSliderConfig } from '@egose/shadcn-theme-ng/form-slider';
33
+ // tw variant: replace with '@egose/shadcn-theme-ng-tw/form-slider'
34
+ ```
35
+
36
+ Standalone usage:
37
+
38
+ ```ts
39
+ import { Component } from '@angular/core';
40
+ import { ReactiveFormsModule } from '@angular/forms';
41
+ import { EgFormSlider } from '@egose/shadcn-theme-ng/form-slider';
42
+
43
+ @Component({
44
+ selector: 'app-demo',
45
+ standalone: true,
46
+ imports: [ReactiveFormsModule, EgFormSlider],
47
+ template: `...`,
48
+ })
49
+ export class DemoComponent {}
50
+ ```
51
+
52
+ NgModule-based consumer: add `EgFormSlider` (and `ReactiveFormsModule`) to the module's
53
+ `imports` — it is a standalone component, not a module.
54
+
55
+ `ControlValueAccessor` behavior: `eg-form-slider` itself is not a `ControlValueAccessor`; the
56
+ inner `hlm-slider` is (bound via `formControlName`), so `formControlName`/`formGroup` handling,
57
+ `Validators`, and `disabled` state from the control all flow through the parent form. Thumb count
58
+ follows the model array length (e.g. `[20, 80]` renders two thumbs).
59
+
60
+ ## Anatomy / Structure
61
+
62
+ ```html
63
+ <form [formGroup]="form">
64
+ <eg-form-slider controlName="volume" label="Volume" [min]="0" [max]="100" [step]="5" />
65
+ </form>
66
+ ```
67
+
68
+ Selector (from source): `eg-form-slider` (standalone component, host `tw:w-full`).
69
+
70
+ ## API reference
71
+
72
+ ### `EgFormSlider` — `eg-form-slider`
73
+
74
+ | Input | Type | Default | Description |
75
+ | ------------- | --------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
76
+ | `controlName` | `string` | `''` | `formControlName` key inside the parent `FormGroup`. **Required.** |
77
+ | `label` | `string \| undefined` | — | Label text (hidden when omitted). |
78
+ | `error` | `string \| undefined` | — | Error text shown when invalid. |
79
+ | `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`. |
80
+ | `hint` | `string \| undefined` | — | Hint text shown otherwise. |
81
+ | `controlId` | `string \| undefined` | — | Explicit id (first priority for `effectiveId`). |
82
+ | `id` | `string \| undefined` | — | Fallback id (second priority). |
83
+ | `min` | `number` | `0` | Minimum value forwarded to the slider. |
84
+ | `max` | `number` | `100` | Maximum value forwarded to the slider. |
85
+ | `step` | `number` | `1` | Step value forwarded to the slider. |
86
+ | `disabled` | `boolean` | `false` | Locks interaction (form control stays enabled). |
87
+ | `required` | `boolean` | `false` | Shows a red `*` next to the label. |
88
+ | `class` | `ClassValue` | `''` | Extra host classes (base `tw:w-full`). |
89
+ | `labelClass` | `string` | `''` | Extra label classes (base `tw:mb-1`). |
90
+ | `sliderClass` | `string` | `''` | Extra slider classes (base `tw:w-full`). |
91
+ | `errorClass` | `string` | `''` | Extra error classes (base `tw:mt-0`). |
92
+ | `hintClass` | `string` | `''` | Extra hint classes (base `tw:mt-0`). |
93
+
94
+ | Member | Description |
95
+ | -------------------- | -------------------------------------------------------------- |
96
+ | `effectiveId` | `controlId() \|\| id() \|\| generated` — wired to slider `id`. |
97
+ | `labelId` | `effectiveId + '-label'` — referenced by `aria-labelledby`. |
98
+ | `errorId` / `hintId` | `effectiveId + '-error' / '-hint'`. |
99
+
100
+ Requires a `[formGroup]` ancestor (injects `FormGroupDirective`, provides `ControlContainer → FormGroupDirective`).
101
+
102
+ ## Examples
103
+
104
+ ### 1. Basic volume slider
105
+
106
+ ```ts
107
+ import { Component, inject } from '@angular/core';
108
+ import { FormBuilder, ReactiveFormsModule } from '@angular/forms';
109
+ import { EgFormSlider } from '@egose/shadcn-theme-ng/form-slider';
110
+
111
+ @Component({
112
+ selector: 'app-volume',
113
+ standalone: true,
114
+ imports: [ReactiveFormsModule, EgFormSlider],
115
+ template: `
116
+ <form [formGroup]="form">
117
+ <eg-form-slider controlName="volume" label="Volume" [min]="0" [max]="100" [step]="5" />
118
+ <p>Volume is {{ form.value.volume?.[0] }}.</p>
119
+ </form>
120
+ `,
121
+ })
122
+ export class VolumeComponent {
123
+ private readonly fb = inject(FormBuilder);
124
+ readonly form = this.fb.group({ volume: [[20] as number[]] });
125
+ }
126
+ ```
127
+
128
+ ### 2. Price range (two thumbs)
129
+
130
+ ```ts
131
+ import { Component, inject } from '@angular/core';
132
+ import { FormBuilder, ReactiveFormsModule } from '@angular/forms';
133
+ import { EgFormSlider } from '@egose/shadcn-theme-ng/form-slider';
134
+
135
+ @Component({
136
+ selector: 'app-price',
137
+ standalone: true,
138
+ imports: [ReactiveFormsModule, EgFormSlider],
139
+ template: `
140
+ <form [formGroup]="form">
141
+ <eg-form-slider
142
+ controlName="price"
143
+ label="Price range"
144
+ [min]="0"
145
+ [max]="500"
146
+ [step]="10"
147
+ hint="Drag either thumb."
148
+ />
149
+ </form>
150
+ `,
151
+ })
152
+ export class PriceComponent {
153
+ private readonly fb = inject(FormBuilder);
154
+ readonly form = this.fb.group({ price: [[50, 300] as number[]] });
155
+ }
156
+ ```
157
+
158
+ ## Accessibility notes
159
+
160
+ - The label is linked via `aria-labelledby` (sliders have no `for`-compatible control); always pass a `label`.
161
+ - `BrnSlider` currently accepts but does not render `aria-labelledby` on its host — the binding documents intent and activates if upstream renders it. Error/hint ids render without an input-level `describedby` link for the same reason.
162
+
163
+ ## Theming / CSS variables
164
+
165
+ No component-specific CSS variables. Style per-instance via `class` / `labelClass` / `sliderClass` / `errorClass` / `hintClass` (precedence: library base < global config < per-instance).
166
+
167
+ Global defaults per styling slot via the wrapper config:
168
+
169
+ ```ts
170
+ import { provideEgFormSliderConfig } from '@egose/shadcn-theme-ng/form-slider';
171
+
172
+ await bootstrapApplication(App, {
173
+ providers: [provideEgFormSliderConfig({ labelClass: 'tw:font-medium' })],
174
+ });
175
+ ```
176
+
177
+ The host keeps `tw:w-full`; constrain width with `class` (e.g. `tw:max-w-sm`) or a wrapping container.
178
+
179
+ ## Related subpaths
180
+
181
+ - `@egose/shadcn-theme-ng/slider` — raw `hlm-slider` for custom layouts.
182
+ - `@egose/shadcn-theme-ng/form-field` — `hlm-form-field` / `hlm-error` / `hlm-hint` used internally.
183
+ - `@egose/shadcn-theme-ng/form-field-simple` — alternative minimal wrapper when you compose controls by hand.
@@ -0,0 +1,218 @@
1
+ import * as i0 from '@angular/core';
2
+ import { InjectionToken, inject, input, numberAttribute, 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-tw/form-field';
6
+ import { HlmLabel } from '@egose/shadcn-theme-ng-tw/label';
7
+ import { HlmSlider } from '@egose/shadcn-theme-ng-tw/slider';
8
+ import { hlm } from '@egose/shadcn-theme-ng-tw/utils';
9
+
10
+ const EgFormSliderConfigToken = new InjectionToken('EgFormSliderConfig');
11
+ function provideEgFormSliderConfig(config) {
12
+ return { provide: EgFormSliderConfigToken, useValue: { ...config } };
13
+ }
14
+ function injectEgFormSliderConfig() {
15
+ return inject(EgFormSliderConfigToken, { optional: true }) ?? {};
16
+ }
17
+
18
+ class EgFormSlider {
19
+ formGroupDirective = inject(FormGroupDirective);
20
+ _errorMessages = injectEgFormErrorMessages();
21
+ generatedId = inject(HlmFormIdGenerator).generate('eg-form-slider');
22
+ _config = injectEgFormSliderConfig();
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
+ disabled = input(false, /* @ts-ignore */
43
+ ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
44
+ required = input(false, /* @ts-ignore */
45
+ ...(ngDevMode ? [{ debugName: "required" }] : /* istanbul ignore next */ []));
46
+ min = input(0, { ...(ngDevMode ? { debugName: "min" } : /* istanbul ignore next */ {}), transform: numberAttribute });
47
+ max = input(100, { ...(ngDevMode ? { debugName: "max" } : /* istanbul ignore next */ {}), transform: numberAttribute });
48
+ step = input(1, { ...(ngDevMode ? { debugName: "step" } : /* istanbul ignore next */ {}), transform: numberAttribute });
49
+ effectiveId = computed(() => this.controlId() || this.id() || this.generatedId, /* @ts-ignore */
50
+ ...(ngDevMode ? [{ debugName: "effectiveId" }] : /* istanbul ignore next */ []));
51
+ labelId = computed(() => `${this.effectiveId()}-label`, /* @ts-ignore */
52
+ ...(ngDevMode ? [{ debugName: "labelId" }] : /* istanbul ignore next */ []));
53
+ errorId = computed(() => `${this.effectiveId()}-error`, /* @ts-ignore */
54
+ ...(ngDevMode ? [{ debugName: "errorId" }] : /* istanbul ignore next */ []));
55
+ hintId = computed(() => `${this.effectiveId()}-hint`, /* @ts-ignore */
56
+ ...(ngDevMode ? [{ debugName: "hintId" }] : /* istanbul ignore next */ []));
57
+ /**
58
+ * Displayed message: explicit `error()` wins; otherwise (when `autoError()`)
59
+ * auto-resolved from the control's `ValidationErrors`. Plain method (not a
60
+ * computed): `ValidationErrors` is not a signal, so the control must be read
61
+ * fresh on every change-detection pass.
62
+ */
63
+ resolvedError() {
64
+ const explicit = this.error();
65
+ if (explicit)
66
+ return explicit;
67
+ if (!this.autoError())
68
+ return undefined;
69
+ const control = this.formGroupDirective.form.get(this.controlName());
70
+ return resolveEgFormError(control?.errors ?? null, this.label(), this._errorMessages);
71
+ }
72
+ /**
73
+ * Whether the error is surfaced: message present + control invalid +
74
+ * touched/dirty/submitted. Gates the visual `<hlm-error>` (and
75
+ * `describedBy()`, where present) so sighted and screen-reader output agree.
76
+ */
77
+ showError() {
78
+ const control = this.formGroupDirective.form.get(this.controlName());
79
+ return (!!this.resolvedError() &&
80
+ !!control?.invalid &&
81
+ (control.dirty || control.touched || this.formGroupDirective.submitted));
82
+ }
83
+ /**
84
+ * Combined lock for the brain `linkedSignal`-based disabled state: the raw
85
+ * input write always carries the resolved value, so a same-pass
86
+ * wrapper-toggle + `control.disable()` cannot clobber CVA state.
87
+ */
88
+ effectiveDisabled() {
89
+ return this.disabled() || !!this.formGroupDirective.form.get(this.controlName())?.disabled;
90
+ }
91
+ // NOTE: BrnSlider exposes aria-labelledby but no aria-describedby, so error/hint
92
+ // ids render for sighted users without an input-level describedby link.
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
+ sliderClass = input('', /* @ts-ignore */
98
+ ...(ngDevMode ? [{ debugName: "sliderClass" }] : /* 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('tw:w-full', this.userClass()), /* @ts-ignore */
105
+ ...(ngDevMode ? [{ debugName: "$userClass" }] : /* istanbul ignore next */ []));
106
+ $labelClass = computed(() => hlm('tw:mb-1', this._config.labelClass, this.labelClass()), /* @ts-ignore */
107
+ ...(ngDevMode ? [{ debugName: "$labelClass" }] : /* istanbul ignore next */ []));
108
+ $sliderClass = computed(() => hlm('tw:w-full', this._config.sliderClass, this.sliderClass()), /* @ts-ignore */
109
+ ...(ngDevMode ? [{ debugName: "$sliderClass" }] : /* istanbul ignore next */ []));
110
+ $errorClass = computed(() => hlm('tw:mt-0', this._config.errorClass, this.errorClass()), /* @ts-ignore */
111
+ ...(ngDevMode ? [{ debugName: "$errorClass" }] : /* istanbul ignore next */ []));
112
+ $hintClass = computed(() => hlm('tw: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: EgFormSlider, deps: [], target: i0.ɵɵFactoryTarget.Component });
115
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.3", type: EgFormSlider, isStandalone: true, selector: "eg-form-slider", 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 }, min: { classPropertyName: "min", publicName: "min", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, step: { classPropertyName: "step", publicName: "step", 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 }, sliderClass: { classPropertyName: "sliderClass", publicName: "sliderClass", 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: `
116
+ @let lbl = label();
117
+ @let cnm = controlName();
118
+ @let hnt = hint();
119
+ @let rqrd = required();
120
+
121
+ <hlm-form-field>
122
+ @if (lbl) {
123
+ <label hlmLabel [id]="labelId()" [class]="$labelClass()"
124
+ >{{ lbl }}
125
+ @if (rqrd) {
126
+ <span class="tw:text-red-500">*</span>
127
+ }
128
+ </label>
129
+ }
130
+
131
+ <hlm-slider
132
+ [id]="effectiveId()"
133
+ [formControlName]="cnm"
134
+ [min]="min()"
135
+ [max]="max()"
136
+ [step]="step()"
137
+ [disabled]="effectiveDisabled()"
138
+ [aria-labelledby]="lbl ? labelId() : null"
139
+ [class]="$sliderClass()"
140
+ />
141
+
142
+ @if (showError()) {
143
+ <hlm-error [id]="errorId()" [class]="$errorClass()">
144
+ {{ resolvedError() }}
145
+ </hlm-error>
146
+ }
147
+
148
+ @if (hnt) {
149
+ <hlm-hint [id]="hintId()" [class]="$hintClass()">
150
+ {{ hnt }}
151
+ </hlm-hint>
152
+ }
153
+ </hlm-form-field>
154
+ `, 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: "component", type: HlmSlider, selector: "hlm-slider, brn-slider [hlm]" }] });
155
+ }
156
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: EgFormSlider, decorators: [{
157
+ type: Component,
158
+ args: [{
159
+ selector: 'eg-form-slider',
160
+ standalone: true,
161
+ host: {
162
+ '[class]': '$userClass()',
163
+ },
164
+ imports: [ReactiveFormsModule, HlmFormField, HlmError, HlmHint, HlmLabel, HlmSlider],
165
+ providers: [{ provide: ControlContainer, useExisting: FormGroupDirective }],
166
+ template: `
167
+ @let lbl = label();
168
+ @let cnm = controlName();
169
+ @let hnt = hint();
170
+ @let rqrd = required();
171
+
172
+ <hlm-form-field>
173
+ @if (lbl) {
174
+ <label hlmLabel [id]="labelId()" [class]="$labelClass()"
175
+ >{{ lbl }}
176
+ @if (rqrd) {
177
+ <span class="tw:text-red-500">*</span>
178
+ }
179
+ </label>
180
+ }
181
+
182
+ <hlm-slider
183
+ [id]="effectiveId()"
184
+ [formControlName]="cnm"
185
+ [min]="min()"
186
+ [max]="max()"
187
+ [step]="step()"
188
+ [disabled]="effectiveDisabled()"
189
+ [aria-labelledby]="lbl ? labelId() : null"
190
+ [class]="$sliderClass()"
191
+ />
192
+
193
+ @if (showError()) {
194
+ <hlm-error [id]="errorId()" [class]="$errorClass()">
195
+ {{ resolvedError() }}
196
+ </hlm-error>
197
+ }
198
+
199
+ @if (hnt) {
200
+ <hlm-hint [id]="hintId()" [class]="$hintClass()">
201
+ {{ hnt }}
202
+ </hlm-hint>
203
+ }
204
+ </hlm-form-field>
205
+ `,
206
+ }]
207
+ }], 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 }] }], min: [{ type: i0.Input, args: [{ isSignal: true, alias: "min", required: false }] }], max: [{ type: i0.Input, args: [{ isSignal: true, alias: "max", required: false }] }], step: [{ type: i0.Input, args: [{ isSignal: true, alias: "step", required: false }] }], userClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], labelClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "labelClass", required: false }] }], sliderClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "sliderClass", required: false }] }], errorClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "errorClass", required: false }] }], hintClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "hintClass", required: false }] }] } });
208
+
209
+ /*
210
+ * Public API Surface of form-slider
211
+ */
212
+
213
+ /**
214
+ * Generated bundle index. Do not edit.
215
+ */
216
+
217
+ export { EgFormSlider, injectEgFormSliderConfig, provideEgFormSliderConfig };
218
+
@@ -0,0 +1,24 @@
1
+ {
2
+ "name": "form-slider",
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-slider.mjs",
13
+ "typings": "types/form-slider.d.ts",
14
+ "exports": {
15
+ "./package.json": {
16
+ "default": "./package.json"
17
+ },
18
+ ".": {
19
+ "types": "./types/form-slider.d.ts",
20
+ "default": "./fesm2022/form-slider.mjs"
21
+ }
22
+ },
23
+ "type": "module"
24
+ }
@@ -0,0 +1,80 @@
1
+ import * as _angular_core from '@angular/core';
2
+ import { ValueProvider } from '@angular/core';
3
+ import { ClassValue } from 'clsx';
4
+ import { NumberInput } from '@angular/cdk/coercion';
5
+
6
+ declare class EgFormSlider {
7
+ private readonly formGroupDirective;
8
+ private readonly _errorMessages;
9
+ private readonly generatedId;
10
+ private readonly _config;
11
+ label: _angular_core.InputSignal<string | undefined>;
12
+ controlId: _angular_core.InputSignal<string | undefined>;
13
+ controlName: _angular_core.InputSignal<string>;
14
+ error: _angular_core.InputSignal<string | undefined>;
15
+ /**
16
+ * Auto-resolve the displayed message from the control's `ValidationErrors`
17
+ * when `error()` is unset. Explicit `error()` always wins. Set to `false`
18
+ * for manual-only messages.
19
+ */
20
+ autoError: _angular_core.InputSignal<boolean>;
21
+ hint: _angular_core.InputSignal<string | undefined>;
22
+ id: _angular_core.InputSignal<string | undefined>;
23
+ disabled: _angular_core.InputSignal<boolean>;
24
+ required: _angular_core.InputSignal<boolean>;
25
+ min: _angular_core.InputSignalWithTransform<number, NumberInput>;
26
+ max: _angular_core.InputSignalWithTransform<number, NumberInput>;
27
+ step: _angular_core.InputSignalWithTransform<number, NumberInput>;
28
+ readonly effectiveId: _angular_core.Signal<string>;
29
+ readonly labelId: _angular_core.Signal<string>;
30
+ readonly errorId: _angular_core.Signal<string>;
31
+ readonly hintId: _angular_core.Signal<string>;
32
+ /**
33
+ * Displayed message: explicit `error()` wins; otherwise (when `autoError()`)
34
+ * auto-resolved from the control's `ValidationErrors`. Plain method (not a
35
+ * computed): `ValidationErrors` is not a signal, so the control must be read
36
+ * fresh on every change-detection pass.
37
+ */
38
+ protected resolvedError(): string | undefined;
39
+ /**
40
+ * Whether the error is surfaced: message present + control invalid +
41
+ * touched/dirty/submitted. Gates the visual `<hlm-error>` (and
42
+ * `describedBy()`, where present) so sighted and screen-reader output agree.
43
+ */
44
+ protected showError(): boolean;
45
+ /**
46
+ * Combined lock for the brain `linkedSignal`-based disabled state: the raw
47
+ * input write always carries the resolved value, so a same-pass
48
+ * wrapper-toggle + `control.disable()` cannot clobber CVA state.
49
+ */
50
+ effectiveDisabled(): boolean;
51
+ userClass: _angular_core.InputSignal<ClassValue>;
52
+ labelClass: _angular_core.InputSignal<string>;
53
+ sliderClass: _angular_core.InputSignal<string>;
54
+ errorClass: _angular_core.InputSignal<string>;
55
+ hintClass: _angular_core.InputSignal<string>;
56
+ $userClass: _angular_core.Signal<string>;
57
+ $labelClass: _angular_core.Signal<string>;
58
+ $sliderClass: _angular_core.Signal<string>;
59
+ $errorClass: _angular_core.Signal<string>;
60
+ $hintClass: _angular_core.Signal<string>;
61
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<EgFormSlider, never>;
62
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<EgFormSlider, "eg-form-slider", 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; }; "min": { "alias": "min"; "required": false; "isSignal": true; }; "max": { "alias": "max"; "required": false; "isSignal": true; }; "step": { "alias": "step"; "required": false; "isSignal": true; }; "userClass": { "alias": "class"; "required": false; "isSignal": true; }; "labelClass": { "alias": "labelClass"; "required": false; "isSignal": true; }; "sliderClass": { "alias": "sliderClass"; "required": false; "isSignal": true; }; "errorClass": { "alias": "errorClass"; "required": false; "isSignal": true; }; "hintClass": { "alias": "hintClass"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
63
+ }
64
+
65
+ interface EgFormSliderConfig {
66
+ /**
67
+ * Global class defaults for `eg-form-slider` styling slots.
68
+ * Each is merged under the matching per-instance `*Class` input
69
+ * (library base < global config < per-instance).
70
+ */
71
+ labelClass?: string;
72
+ sliderClass?: string;
73
+ errorClass?: string;
74
+ hintClass?: string;
75
+ }
76
+ declare function provideEgFormSliderConfig(config: Partial<EgFormSliderConfig>): ValueProvider;
77
+ declare function injectEgFormSliderConfig(): EgFormSliderConfig;
78
+
79
+ export { EgFormSlider, injectEgFormSliderConfig, provideEgFormSliderConfig };
80
+ export type { EgFormSliderConfig };