@egose/shadcn-theme-ng-tw 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (92) 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 +177 -0
  12. package/form-autocomplete/fesm2022/form-autocomplete.mjs +211 -0
  13. package/form-autocomplete/package.json +24 -0
  14. package/form-autocomplete/types/form-autocomplete.d.ts +61 -0
  15. package/form-checkbox/README.md +13 -3
  16. package/form-checkbox/fesm2022/form-checkbox.mjs +22 -9
  17. package/form-checkbox/types/form-checkbox.d.ts +23 -4
  18. package/form-combobox/README.md +202 -0
  19. package/form-combobox/fesm2022/form-combobox.mjs +273 -0
  20. package/form-combobox/package.json +24 -0
  21. package/form-combobox/types/form-combobox.d.ts +73 -0
  22. package/form-date-picker/README.md +48 -22
  23. package/form-date-picker/fesm2022/form-date-picker.mjs +60 -16
  24. package/form-date-picker/types/form-date-picker.d.ts +17 -1
  25. package/form-date-picker-multi/README.md +191 -0
  26. package/form-date-picker-multi/fesm2022/form-date-picker-multi.mjs +239 -0
  27. package/form-date-picker-multi/package.json +24 -0
  28. package/form-date-picker-multi/types/form-date-picker-multi.d.ts +58 -0
  29. package/form-date-range-picker/README.md +253 -0
  30. package/form-date-range-picker/fesm2022/form-date-range-picker.mjs +236 -0
  31. package/form-date-range-picker/package.json +24 -0
  32. package/form-date-range-picker/types/form-date-range-picker.d.ts +55 -0
  33. package/form-input-otp/README.md +194 -0
  34. package/form-input-otp/fesm2022/form-input-otp.mjs +194 -0
  35. package/form-input-otp/package.json +24 -0
  36. package/form-input-otp/types/form-input-otp.d.ts +58 -0
  37. package/form-month-year-picker/README.md +188 -0
  38. package/form-month-year-picker/fesm2022/form-month-year-picker.mjs +229 -0
  39. package/form-month-year-picker/package.json +24 -0
  40. package/form-month-year-picker/types/form-month-year-picker.d.ts +53 -0
  41. package/form-native-select/README.md +205 -0
  42. package/form-native-select/fesm2022/form-native-select.mjs +187 -0
  43. package/form-native-select/package.json +24 -0
  44. package/form-native-select/types/form-native-select.d.ts +57 -0
  45. package/form-phone-input/README.md +188 -0
  46. package/form-phone-input/fesm2022/form-phone-input.mjs +203 -0
  47. package/form-phone-input/package.json +24 -0
  48. package/form-phone-input/types/form-phone-input.d.ts +58 -0
  49. package/form-radio-group/README.md +198 -0
  50. package/form-radio-group/fesm2022/form-radio-group.mjs +211 -0
  51. package/form-radio-group/package.json +24 -0
  52. package/form-radio-group/types/form-radio-group.d.ts +63 -0
  53. package/form-searchable-multiselect/README.md +11 -1
  54. package/form-searchable-multiselect/fesm2022/form-searchable-multiselect.mjs +19 -10
  55. package/form-searchable-multiselect/types/form-searchable-multiselect.d.ts +18 -1
  56. package/form-select/README.md +10 -0
  57. package/form-select/fesm2022/form-select.mjs +24 -15
  58. package/form-select/types/form-select.d.ts +18 -1
  59. package/form-slider/README.md +182 -0
  60. package/form-slider/fesm2022/form-slider.mjs +186 -0
  61. package/form-slider/package.json +24 -0
  62. package/form-slider/types/form-slider.d.ts +60 -0
  63. package/form-switch/README.md +173 -0
  64. package/form-switch/fesm2022/form-switch.mjs +178 -0
  65. package/form-switch/package.json +24 -0
  66. package/form-switch/types/form-switch.d.ts +50 -0
  67. package/form-text-input/README.md +10 -0
  68. package/form-text-input/fesm2022/form-text-input.mjs +19 -10
  69. package/form-text-input/types/form-text-input.d.ts +18 -1
  70. package/form-textarea/README.md +11 -1
  71. package/form-textarea/fesm2022/form-textarea.mjs +19 -10
  72. package/form-textarea/types/form-textarea.d.ts +18 -1
  73. package/form-toggle/README.md +186 -0
  74. package/form-toggle/fesm2022/form-toggle.mjs +241 -0
  75. package/form-toggle/package.json +24 -0
  76. package/form-toggle/types/form-toggle.d.ts +82 -0
  77. package/form-toggle-group/README.md +176 -0
  78. package/form-toggle-group/fesm2022/form-toggle-group.mjs +216 -0
  79. package/form-toggle-group/package.json +24 -0
  80. package/form-toggle-group/types/form-toggle-group.d.ts +65 -0
  81. package/input-group/fesm2022/input-group.mjs +20 -10
  82. package/input-group/types/input-group.d.ts +4 -1
  83. package/native-select/fesm2022/native-select.mjs +18 -6
  84. package/native-select/types/native-select.d.ts +7 -2
  85. package/package.json +57 -1
  86. package/phone-input/README.md +114 -0
  87. package/phone-input/fesm2022/phone-input.mjs +191 -0
  88. package/phone-input/package.json +24 -0
  89. package/phone-input/types/phone-input.d.ts +67 -0
  90. package/sheet/fesm2022/sheet.mjs +1 -1
  91. package/switch/fesm2022/switch.mjs +7 -5
  92. package/switch/types/switch.d.ts +2 -1
@@ -0,0 +1,176 @@
1
+ # Form Toggle Group (`@egose/shadcn-theme-ng/form-toggle-group`)
2
+
3
+ A ready-made reactive-form option group: label + `hlm-toggle-group` buttons + validation error/hint display in one tag. For single- or multi-select button groups (alignment, view modes, formatting).
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-toggle-group` exposes no `BrnFieldControl`), `HlmError` / `HlmHint`, `HlmLabel`, and `HlmToggleGroup` / `HlmToggleGroupItem` from `@egose/shadcn-theme-ng/toggle-group`. The group is bound with `[formControlName]="controlName()"`, so the parent `FormGroup` owns the `string | 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-toggle-group` and `@egose/shadcn-theme-ng-tw/form-toggle-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/toggle-group`, `@egose/shadcn-theme-ng/toggle`, `@egose/shadcn-theme-ng/form-field`,
25
+ `@egose/shadcn-theme-ng/form-field-simple`, and `@egose/shadcn-theme-ng/label`.
26
+
27
+ ## Imports
28
+
29
+ Exported from the subpath root (`projects/form-toggle-group/src/public-api.ts`):
30
+
31
+ ```ts
32
+ import { EgFormToggleGroup, provideEgFormToggleGroupConfig } from '@egose/shadcn-theme-ng/form-toggle-group';
33
+ // tw variant: replace with '@egose/shadcn-theme-ng-tw/form-toggle-group'
34
+ ```
35
+
36
+ `ControlValueAccessor` behavior: `eg-form-toggle-group` itself is not a `ControlValueAccessor`; the
37
+ inner `hlm-toggle-group` is (bound via `formControlName`), so `formControlName`/`formGroup` handling,
38
+ `Validators`, and `disabled` state from the control all flow through the parent form.
39
+
40
+ ## Anatomy / Structure
41
+
42
+ ```html
43
+ <form [formGroup]="form">
44
+ <eg-form-toggle-group controlName="align" label="Align" [options]="options" [required]="true" error="Pick one." />
45
+ </form>
46
+ ```
47
+
48
+ Selector (from source): `eg-form-toggle-group` (standalone component, host `tw:w-full`).
49
+
50
+ ## API reference
51
+
52
+ ### `EgFormToggleGroup` — `eg-form-toggle-group`
53
+
54
+ | Input | Type | Default | Description |
55
+ | ------------- | ------------------------------- | ----------- | ------------------------------------------------------------------ |
56
+ | `controlName` | `string` | `''` | `formControlName` key inside the parent `FormGroup`. **Required.** |
57
+ | `label` | `string \| undefined` | — | Group label text (hidden when omitted). |
58
+ | `error` | `string \| undefined` | — | Error text shown when invalid. |
59
+ | `hint` | `string \| undefined` | — | Hint text shown otherwise. |
60
+ | `controlId` | `string \| undefined` | — | Explicit id prefix (first priority for `effectiveId`). |
61
+ | `id` | `string \| undefined` | — | Fallback id prefix (second priority). |
62
+ | `type` | `'single' \| 'multiple'` | `'single'` | Selection mode forwarded to the group. |
63
+ | `disabled` | `boolean` | `false` | Locks interaction (form control stays enabled). |
64
+ | `required` | `boolean` | `false` | Shows a red `*` next to the label. |
65
+ | `variant` | toggle variant | `'default'` | Variant forwarded to the group. |
66
+ | `size` | toggle size | `'default'` | Size forwarded to the group. |
67
+ | `options` | `{ value, label, disabled? }[]` | `[]` | Rendered as `hlmToggleGroupItem` buttons. |
68
+ | `class` | `ClassValue` | `''` | Extra host classes (base `tw:w-full`). |
69
+ | `labelClass` | `string` | `''` | Extra group-label classes (base `tw:mb-1`). |
70
+ | `groupClass` | `string` | `''` | Extra group classes. |
71
+ | `errorClass` | `string` | `''` | Extra error classes (base `tw:mt-0`). |
72
+ | `hintClass` | `string` | `''` | Extra hint classes (base `tw:mt-0`). |
73
+
74
+ | Member | Description |
75
+ | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
76
+ | `effectiveId` | `controlId() \|\| id() \|\| generated` — id prefix for `errorId` / `hintId`. |
77
+ | `errorId` / `hintId` | `effectiveId + '-error' / '-hint'`. |
78
+ | `describedBy()` | `errorId` when `error()` is set and control is invalid + dirty/touched, else `hintId` when `hint()` is set, else `null` — wired to each item's `aria-describedby`. |
79
+
80
+ Requires a `[formGroup]` ancestor (injects `FormGroupDirective`, provides `ControlContainer → FormGroupDirective`).
81
+
82
+ ## Examples
83
+
84
+ ### 1. Single-select alignment
85
+
86
+ ```ts
87
+ import { Component, inject } from '@angular/core';
88
+ import { FormBuilder, ReactiveFormsModule, Validators } from '@angular/forms';
89
+ import { EgFormToggleGroup } from '@egose/shadcn-theme-ng/form-toggle-group';
90
+
91
+ @Component({
92
+ selector: 'app-align',
93
+ standalone: true,
94
+ imports: [ReactiveFormsModule, EgFormToggleGroup],
95
+ template: `
96
+ <form [formGroup]="form" (ngSubmit)="submit()">
97
+ <eg-form-toggle-group controlName="align" label="Align" [options]="options" [required]="true" error="Pick one." />
98
+ <button type="submit" [disabled]="form.invalid">Save</button>
99
+ </form>
100
+ `,
101
+ })
102
+ export class AlignComponent {
103
+ private readonly fb = inject(FormBuilder);
104
+ readonly form = this.fb.group({ align: ['', Validators.required] });
105
+ readonly options = [
106
+ { value: 'left', label: 'Left' },
107
+ { value: 'center', label: 'Center' },
108
+ { value: 'right', label: 'Right' },
109
+ ];
110
+ submit() {
111
+ console.log(this.form.value.align);
112
+ }
113
+ }
114
+ ```
115
+
116
+ ### 2. Multi-select formats
117
+
118
+ ```ts
119
+ import { Component, inject } from '@angular/core';
120
+ import { FormBuilder, ReactiveFormsModule } from '@angular/forms';
121
+ import { EgFormToggleGroup } from '@egose/shadcn-theme-ng/form-toggle-group';
122
+
123
+ @Component({
124
+ selector: 'app-format-group',
125
+ standalone: true,
126
+ imports: [ReactiveFormsModule, EgFormToggleGroup],
127
+ template: `
128
+ <form [formGroup]="form">
129
+ <eg-form-toggle-group
130
+ controlName="formats"
131
+ label="Formats"
132
+ type="multiple"
133
+ [options]="options"
134
+ hint="Combine as needed."
135
+ />
136
+ </form>
137
+ `,
138
+ })
139
+ export class FormatGroupComponent {
140
+ private readonly fb = inject(FormBuilder);
141
+ readonly form = this.fb.group({ formats: [<string[]>[]] });
142
+ readonly options = [
143
+ { value: 'bold', label: 'Bold' },
144
+ { value: 'italic', label: 'Italic' },
145
+ { value: 'underline', label: 'Underline' },
146
+ ];
147
+ }
148
+ ```
149
+
150
+ ## Accessibility notes
151
+
152
+ - The group label is visual; each item carries its option text and `aria-describedby` (error/hint id).
153
+ - The required `*` is visual; pair with `Validators.required` so assistive tech and validation agree.
154
+
155
+ ## Theming / CSS variables
156
+
157
+ No component-specific CSS variables. Style per-instance via `class` / `labelClass` / `groupClass` / `errorClass` / `hintClass` (precedence: library base < global config < per-instance); `variant` / `size` drive the button look.
158
+
159
+ Global defaults per styling slot via the wrapper config:
160
+
161
+ ```ts
162
+ import { provideEgFormToggleGroupConfig } from '@egose/shadcn-theme-ng/form-toggle-group';
163
+
164
+ await bootstrapApplication(App, {
165
+ providers: [provideEgFormToggleGroupConfig({ labelClass: 'tw:font-medium' })],
166
+ });
167
+ ```
168
+
169
+ ## Related subpaths
170
+
171
+ - `@egose/shadcn-theme-ng/toggle-group` — raw `hlm-toggle-group` / `hlmToggleGroupItem` for custom layouts.
172
+ - `@egose/shadcn-theme-ng/toggle` — raw `hlmToggle` directive.
173
+ - `@egose/shadcn-theme-ng/form-toggle` — the single boolean toggle (`eg-form-toggle`).
174
+ - `@egose/shadcn-theme-ng/form-radio-group` — single-choice alternative with radios.
175
+ - `@egose/shadcn-theme-ng/form-field` — `hlm-error` / `hlm-hint` used internally.
176
+ - `@egose/shadcn-theme-ng/form-field-simple` — `eg-form-field` used internally.
@@ -0,0 +1,216 @@
1
+ import * as i0 from '@angular/core';
2
+ import { InjectionToken, inject, input, computed, Component } from '@angular/core';
3
+ import * as i1 from '@angular/forms';
4
+ import { FormGroupDirective, ReactiveFormsModule, ControlContainer } from '@angular/forms';
5
+ import { HlmFormIdGenerator, 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 { HlmToggleGroup, HlmToggleGroupItem } from '@egose/shadcn-theme-ng-tw/toggle-group';
9
+ import { hlm } from '@egose/shadcn-theme-ng-tw/utils';
10
+
11
+ const EgFormToggleGroupConfigToken = new InjectionToken('EgFormToggleGroupConfig');
12
+ function provideEgFormToggleGroupConfig(config) {
13
+ return { provide: EgFormToggleGroupConfigToken, useValue: { ...config } };
14
+ }
15
+ function injectEgFormToggleGroupConfig() {
16
+ return inject(EgFormToggleGroupConfigToken, { optional: true }) ?? {};
17
+ }
18
+
19
+ class EgFormToggleGroup {
20
+ formGroupDirective = inject(FormGroupDirective);
21
+ generatedId = inject(HlmFormIdGenerator).generate('eg-form-toggle-group');
22
+ _config = injectEgFormToggleGroupConfig();
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
+ hint = input(undefined, /* @ts-ignore */
32
+ ...(ngDevMode ? [{ debugName: "hint" }] : /* istanbul ignore next */ []));
33
+ id = input(undefined, /* @ts-ignore */
34
+ ...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
35
+ type = input('single', /* @ts-ignore */
36
+ ...(ngDevMode ? [{ debugName: "type" }] : /* istanbul ignore next */ []));
37
+ disabled = input(false, /* @ts-ignore */
38
+ ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
39
+ required = input(false, /* @ts-ignore */
40
+ ...(ngDevMode ? [{ debugName: "required" }] : /* istanbul ignore next */ []));
41
+ variant = input('default', /* @ts-ignore */
42
+ ...(ngDevMode ? [{ debugName: "variant" }] : /* istanbul ignore next */ []));
43
+ size = input('default', /* @ts-ignore */
44
+ ...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
45
+ options = input([], /* @ts-ignore */
46
+ ...(ngDevMode ? [{ debugName: "options" }] : /* 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
+ * Combined lock for the brain `linkedSignal`-based disabled state: the raw
55
+ * input write always carries the resolved value, so a same-pass
56
+ * wrapper-toggle + `control.disable()` cannot clobber CVA state.
57
+ */
58
+ effectiveDisabled() {
59
+ return this.disabled() || !!this.formGroupDirective.form.get(this.controlName())?.disabled;
60
+ }
61
+ describedBy() {
62
+ const control = this.formGroupDirective.form.get(this.controlName());
63
+ return this.error() && control?.invalid && (control.dirty || control.touched)
64
+ ? this.errorId()
65
+ : this.hint()
66
+ ? this.hintId()
67
+ : null;
68
+ }
69
+ // Styling
70
+ userClass = input('', { ...(ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {}), alias: 'class' });
71
+ labelClass = input('', /* @ts-ignore */
72
+ ...(ngDevMode ? [{ debugName: "labelClass" }] : /* istanbul ignore next */ []));
73
+ groupClass = input('', /* @ts-ignore */
74
+ ...(ngDevMode ? [{ debugName: "groupClass" }] : /* istanbul ignore next */ []));
75
+ errorClass = input('', /* @ts-ignore */
76
+ ...(ngDevMode ? [{ debugName: "errorClass" }] : /* istanbul ignore next */ []));
77
+ hintClass = input('', /* @ts-ignore */
78
+ ...(ngDevMode ? [{ debugName: "hintClass" }] : /* istanbul ignore next */ []));
79
+ // Computed classes (library base < global config < per-instance)
80
+ $userClass = computed(() => hlm('tw:w-full', this.userClass()), /* @ts-ignore */
81
+ ...(ngDevMode ? [{ debugName: "$userClass" }] : /* istanbul ignore next */ []));
82
+ $labelClass = computed(() => hlm('tw:mb-1', this._config.labelClass, this.labelClass()), /* @ts-ignore */
83
+ ...(ngDevMode ? [{ debugName: "$labelClass" }] : /* istanbul ignore next */ []));
84
+ $groupClass = computed(() => hlm(this._config.groupClass, this.groupClass()), /* @ts-ignore */
85
+ ...(ngDevMode ? [{ debugName: "$groupClass" }] : /* istanbul ignore next */ []));
86
+ $errorClass = computed(() => hlm('tw:mt-0', this._config.errorClass, this.errorClass()), /* @ts-ignore */
87
+ ...(ngDevMode ? [{ debugName: "$errorClass" }] : /* istanbul ignore next */ []));
88
+ $hintClass = computed(() => hlm('tw:mt-0', this._config.hintClass, this.hintClass()), /* @ts-ignore */
89
+ ...(ngDevMode ? [{ debugName: "$hintClass" }] : /* istanbul ignore next */ []));
90
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: EgFormToggleGroup, deps: [], target: i0.ɵɵFactoryTarget.Component });
91
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.3", type: EgFormToggleGroup, isStandalone: true, selector: "eg-form-toggle-group", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, controlId: { classPropertyName: "controlId", publicName: "controlId", isSignal: true, isRequired: false, transformFunction: null }, controlName: { classPropertyName: "controlName", publicName: "controlName", isSignal: true, isRequired: false, transformFunction: null }, error: { classPropertyName: "error", publicName: "error", isSignal: true, isRequired: false, transformFunction: null }, hint: { classPropertyName: "hint", publicName: "hint", isSignal: true, isRequired: false, transformFunction: null }, id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, type: { classPropertyName: "type", publicName: "type", 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 }, variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", 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: `
92
+ @let lbl = label();
93
+ @let cnm = controlName();
94
+ @let err = error();
95
+ @let hnt = hint();
96
+ @let rqrd = required();
97
+
98
+ <eg-form-field>
99
+ @if (lbl) {
100
+ <span hlmLabel [class]="$labelClass()"
101
+ >{{ lbl }}
102
+ @if (rqrd) {
103
+ <span class="tw:text-red-500">*</span>
104
+ }
105
+ </span>
106
+ }
107
+
108
+ <hlm-toggle-group
109
+ [formControlName]="cnm"
110
+ [type]="type()"
111
+ [disabled]="effectiveDisabled()"
112
+ [variant]="variant()"
113
+ [size]="size()"
114
+ [class]="$groupClass()"
115
+ >
116
+ @for (option of options(); track option.value) {
117
+ <button
118
+ hlmToggleGroupItem
119
+ type="button"
120
+ [value]="option.value"
121
+ [disabled]="option.disabled ?? false"
122
+ [attr.aria-describedby]="describedBy()"
123
+ >
124
+ {{ option.label }}
125
+ </button>
126
+ }
127
+ </hlm-toggle-group>
128
+
129
+ @if (err) {
130
+ <hlm-error [id]="errorId()" [class]="$errorClass()">
131
+ {{ err }}
132
+ </hlm-error>
133
+ }
134
+
135
+ @if (hnt) {
136
+ <hlm-hint [id]="hintId()" [class]="$hintClass()">
137
+ {{ hnt }}
138
+ </hlm-hint>
139
+ }
140
+ </eg-form-field>
141
+ `, 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: "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: HlmToggleGroup, selector: "[hlmToggleGroup],hlm-toggle-group", inputs: ["variant", "size", "spacing", "orientation"] }, { kind: "directive", type: HlmToggleGroupItem, selector: "button[hlmToggleGroupItem]", inputs: ["variant", "size"] }, { kind: "component", type: EgFormField, selector: "eg-form-field", inputs: ["class"] }] });
142
+ }
143
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: EgFormToggleGroup, decorators: [{
144
+ type: Component,
145
+ args: [{
146
+ selector: 'eg-form-toggle-group',
147
+ standalone: true,
148
+ host: {
149
+ '[class]': '$userClass()',
150
+ },
151
+ imports: [ReactiveFormsModule, HlmError, HlmHint, HlmLabel, HlmToggleGroup, HlmToggleGroupItem, EgFormField],
152
+ providers: [{ provide: ControlContainer, useExisting: FormGroupDirective }],
153
+ template: `
154
+ @let lbl = label();
155
+ @let cnm = controlName();
156
+ @let err = error();
157
+ @let hnt = hint();
158
+ @let rqrd = required();
159
+
160
+ <eg-form-field>
161
+ @if (lbl) {
162
+ <span hlmLabel [class]="$labelClass()"
163
+ >{{ lbl }}
164
+ @if (rqrd) {
165
+ <span class="tw:text-red-500">*</span>
166
+ }
167
+ </span>
168
+ }
169
+
170
+ <hlm-toggle-group
171
+ [formControlName]="cnm"
172
+ [type]="type()"
173
+ [disabled]="effectiveDisabled()"
174
+ [variant]="variant()"
175
+ [size]="size()"
176
+ [class]="$groupClass()"
177
+ >
178
+ @for (option of options(); track option.value) {
179
+ <button
180
+ hlmToggleGroupItem
181
+ type="button"
182
+ [value]="option.value"
183
+ [disabled]="option.disabled ?? false"
184
+ [attr.aria-describedby]="describedBy()"
185
+ >
186
+ {{ option.label }}
187
+ </button>
188
+ }
189
+ </hlm-toggle-group>
190
+
191
+ @if (err) {
192
+ <hlm-error [id]="errorId()" [class]="$errorClass()">
193
+ {{ err }}
194
+ </hlm-error>
195
+ }
196
+
197
+ @if (hnt) {
198
+ <hlm-hint [id]="hintId()" [class]="$hintClass()">
199
+ {{ hnt }}
200
+ </hlm-hint>
201
+ }
202
+ </eg-form-field>
203
+ `,
204
+ }]
205
+ }], propDecorators: { label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], controlId: [{ type: i0.Input, args: [{ isSignal: true, alias: "controlId", required: false }] }], controlName: [{ type: i0.Input, args: [{ isSignal: true, alias: "controlName", required: false }] }], error: [{ type: i0.Input, args: [{ isSignal: true, alias: "error", required: false }] }], hint: [{ type: i0.Input, args: [{ isSignal: true, alias: "hint", required: false }] }], id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], type: [{ type: i0.Input, args: [{ isSignal: true, alias: "type", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }], variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", 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 }] }] } });
206
+
207
+ /*
208
+ * Public API Surface of form-toggle-group
209
+ */
210
+
211
+ /**
212
+ * Generated bundle index. Do not edit.
213
+ */
214
+
215
+ export { EgFormToggleGroup, injectEgFormToggleGroupConfig, provideEgFormToggleGroupConfig };
216
+
@@ -0,0 +1,24 @@
1
+ {
2
+ "name": "form-toggle-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-toggle-group.mjs",
13
+ "typings": "types/form-toggle-group.d.ts",
14
+ "exports": {
15
+ "./package.json": {
16
+ "default": "./package.json"
17
+ },
18
+ ".": {
19
+ "types": "./types/form-toggle-group.d.ts",
20
+ "default": "./fesm2022/form-toggle-group.mjs"
21
+ }
22
+ },
23
+ "type": "module"
24
+ }
@@ -0,0 +1,65 @@
1
+ import * as _angular_core from '@angular/core';
2
+ import { ValueProvider } from '@angular/core';
3
+ import { ClassValue } from 'clsx';
4
+
5
+ interface ToggleGroupOption {
6
+ value: string;
7
+ label: string;
8
+ disabled?: boolean;
9
+ }
10
+ declare class EgFormToggleGroup {
11
+ private readonly formGroupDirective;
12
+ private readonly generatedId;
13
+ private readonly _config;
14
+ label: _angular_core.InputSignal<string | undefined>;
15
+ controlId: _angular_core.InputSignal<string | undefined>;
16
+ controlName: _angular_core.InputSignal<string>;
17
+ error: _angular_core.InputSignal<string | undefined>;
18
+ hint: _angular_core.InputSignal<string | undefined>;
19
+ id: _angular_core.InputSignal<string | undefined>;
20
+ type: _angular_core.InputSignal<"single" | "multiple">;
21
+ disabled: _angular_core.InputSignal<boolean>;
22
+ required: _angular_core.InputSignal<boolean>;
23
+ variant: _angular_core.InputSignal<"default" | "outline" | null | undefined>;
24
+ size: _angular_core.InputSignal<"default" | "sm" | "lg" | null | undefined>;
25
+ options: _angular_core.InputSignal<ToggleGroupOption[]>;
26
+ readonly effectiveId: _angular_core.Signal<string>;
27
+ readonly errorId: _angular_core.Signal<string>;
28
+ readonly hintId: _angular_core.Signal<string>;
29
+ /**
30
+ * Combined lock for the brain `linkedSignal`-based disabled state: the raw
31
+ * input write always carries the resolved value, so a same-pass
32
+ * wrapper-toggle + `control.disable()` cannot clobber CVA state.
33
+ */
34
+ effectiveDisabled(): boolean;
35
+ describedBy(): string | null;
36
+ userClass: _angular_core.InputSignal<ClassValue>;
37
+ labelClass: _angular_core.InputSignal<string>;
38
+ groupClass: _angular_core.InputSignal<string>;
39
+ errorClass: _angular_core.InputSignal<string>;
40
+ hintClass: _angular_core.InputSignal<string>;
41
+ $userClass: _angular_core.Signal<string>;
42
+ $labelClass: _angular_core.Signal<string>;
43
+ $groupClass: _angular_core.Signal<string>;
44
+ $errorClass: _angular_core.Signal<string>;
45
+ $hintClass: _angular_core.Signal<string>;
46
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<EgFormToggleGroup, never>;
47
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<EgFormToggleGroup, "eg-form-toggle-group", never, { "label": { "alias": "label"; "required": false; "isSignal": true; }; "controlId": { "alias": "controlId"; "required": false; "isSignal": true; }; "controlName": { "alias": "controlName"; "required": false; "isSignal": true; }; "error": { "alias": "error"; "required": false; "isSignal": true; }; "hint": { "alias": "hint"; "required": false; "isSignal": true; }; "id": { "alias": "id"; "required": false; "isSignal": true; }; "type": { "alias": "type"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "required": { "alias": "required"; "required": false; "isSignal": true; }; "variant": { "alias": "variant"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "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>;
48
+ }
49
+
50
+ interface EgFormToggleGroupConfig {
51
+ /**
52
+ * Global class defaults for `eg-form-toggle-group` styling slots.
53
+ * Each is merged under the matching per-instance `*Class` input
54
+ * (library base < global config < per-instance).
55
+ */
56
+ labelClass?: string;
57
+ groupClass?: string;
58
+ errorClass?: string;
59
+ hintClass?: string;
60
+ }
61
+ declare function provideEgFormToggleGroupConfig(config: Partial<EgFormToggleGroupConfig>): ValueProvider;
62
+ declare function injectEgFormToggleGroupConfig(): EgFormToggleGroupConfig;
63
+
64
+ export { EgFormToggleGroup, injectEgFormToggleGroupConfig, provideEgFormToggleGroupConfig };
65
+ export type { EgFormToggleGroupConfig };
@@ -1,9 +1,9 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Directive, input, NgModule } from '@angular/core';
3
- import { classes } from '@egose/shadcn-theme-ng-tw/utils';
2
+ import { Directive, input, inject, effect, NgModule } from '@angular/core';
3
+ import { classes, hlm } from '@egose/shadcn-theme-ng-tw/utils';
4
4
  import { cva } from 'class-variance-authority';
5
5
  import * as i1 from '@egose/shadcn-theme-ng-tw/button';
6
- import { provideBrnButtonConfig, HlmBtn } from '@egose/shadcn-theme-ng-tw/button';
6
+ import { HlmBtn, provideBrnButtonConfig } from '@egose/shadcn-theme-ng-tw/button';
7
7
  import * as i1$1 from '@egose/shadcn-theme-ng-tw/input';
8
8
  import { HlmInput } from '@egose/shadcn-theme-ng-tw/input';
9
9
  import * as i1$2 from '@egose/shadcn-theme-ng-tw/textarea';
@@ -37,7 +37,7 @@ const inputGroupAddonVariants$1 = cva("tw:text-muted-foreground tw:h-auto tw:gap
37
37
  },
38
38
  },
39
39
  defaultVariants: {
40
- align: "tw:inline-start",
40
+ align: 'inline-start',
41
41
  },
42
42
  });
43
43
  class HlmInputGroupAddon {
@@ -64,10 +64,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImpor
64
64
  const inputGroupAddonVariants = cva('tw:gap-2 tw:text-sm tw:flex tw:items-center tw:shadow-none', {
65
65
  variants: {
66
66
  size: {
67
- xs: "tw:h-6 tw:gap-1 tw:rounded-[calc(var(--radius)-5px)] tw:px-1.5 tw:[&>ng-icon:not([class*='text-'])]:text-[length:--spacing(3.5)]",
67
+ xs: "tw:h-6 tw:gap-1 tw:rounded-[calc(var(--radius)-5px)] tw:px-1.5 tw:[&>ng-icon:not([class*='text-'])]:text-[length:--spacing(3.5)] tw:[&_svg:not([class*='size-'])]:size-3.5",
68
68
  sm: '',
69
- 'icon-xs': 'tw:size-6 tw:rounded-[calc(var(--radius)-5px)] tw:p-0 tw:has-[>ng-icon]:p-0',
70
- 'icon-sm': 'tw:size-8 tw:p-0 tw:has-[>ng-icon]:p-0',
69
+ 'icon-xs': "tw:size-6 tw:rounded-[calc(var(--radius)-5px)] tw:p-0 tw:has-[>ng-icon]:p-0 tw:[&>ng-icon:not([class*='text-'])]:text-[length:--spacing(3)] tw:[&_svg:not([class*='size-'])]:size-3",
70
+ 'icon-sm': "tw:size-8 tw:p-0 tw:has-[>ng-icon]:p-0 tw:[&>ng-icon:not([class*='text-'])]:text-[length:--spacing(4)] tw:[&_svg:not([class*='size-'])]:size-4",
71
71
  },
72
72
  },
73
73
  defaultVariants: {
@@ -75,15 +75,25 @@ const inputGroupAddonVariants = cva('tw:gap-2 tw:text-sm tw:flex tw:items-center
75
75
  },
76
76
  });
77
77
  class HlmInputGroupButton {
78
+ _btn = inject(HlmBtn);
78
79
  size = input('xs', /* @ts-ignore */
79
80
  ...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
80
81
  type = input('button', /* @ts-ignore */
81
82
  ...(ngDevMode ? [{ debugName: "type" }] : /* istanbul ignore next */ []));
83
+ userClass = input('', { ...(ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {}), alias: 'class' });
82
84
  constructor() {
83
- classes(() => inputGroupAddonVariants({ size: this.size() }));
85
+ // HlmBtn renders its classes through a `[class]` host binding, so layering
86
+ // another `classes()` call here would lose: the binding output is treated
87
+ // as base classes and merged last, letting HlmBtn's default `h-9 px-4 py-2`
88
+ // beat the input-group sizing and push the button onto the outer
89
+ // container's borders. Route the variant through `setClass()` instead so it
90
+ // wins over the button defaults while explicit `class` values still win.
91
+ effect(() => {
92
+ this._btn.setClass(hlm(inputGroupAddonVariants({ size: this.size() }), this.userClass()));
93
+ });
84
94
  }
85
95
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: HlmInputGroupButton, deps: [], target: i0.ɵɵFactoryTarget.Directive });
86
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.1.3", type: HlmInputGroupButton, isStandalone: true, selector: "button[hlmInputGroupButton]", inputs: { size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "attr.data-size": "size()", "type": "type()" } }, providers: [
96
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.1.3", type: HlmInputGroupButton, isStandalone: true, selector: "button[hlmInputGroupButton]", inputs: { size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: false, transformFunction: null }, userClass: { classPropertyName: "userClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "attr.data-size": "size()", "type": "type()" } }, providers: [
87
97
  provideBrnButtonConfig({
88
98
  variant: 'ghost',
89
99
  }),
@@ -109,7 +119,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImpor
109
119
  '[type]': 'type()',
110
120
  },
111
121
  }]
112
- }], ctorParameters: () => [], propDecorators: { size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], type: [{ type: i0.Input, args: [{ isSignal: true, alias: "type", required: false }] }] } });
122
+ }], ctorParameters: () => [], propDecorators: { size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], type: [{ type: i0.Input, args: [{ isSignal: true, alias: "type", required: false }] }], userClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
113
123
 
114
124
  class HlmInputGroupInput {
115
125
  constructor() {
@@ -1,4 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
+ import { ClassValue } from 'clsx';
2
3
  import * as i1 from '@egose/shadcn-theme-ng-tw/button';
3
4
  import * as i1$1 from '@egose/shadcn-theme-ng-tw/input';
4
5
  import * as i1$2 from '@egose/shadcn-theme-ng-tw/textarea';
@@ -17,11 +18,13 @@ declare class HlmInputGroupAddon {
17
18
  }
18
19
 
19
20
  declare class HlmInputGroupButton {
21
+ private readonly _btn;
20
22
  readonly size: i0.InputSignal<"xs" | "sm" | "icon-xs" | "icon-sm" | null | undefined>;
21
23
  readonly type: i0.InputSignal<"button" | "submit" | "reset">;
24
+ readonly userClass: i0.InputSignal<ClassValue>;
22
25
  constructor();
23
26
  static ɵfac: i0.ɵɵFactoryDeclaration<HlmInputGroupButton, never>;
24
- static ɵdir: i0.ɵɵDirectiveDeclaration<HlmInputGroupButton, "button[hlmInputGroupButton]", never, { "size": { "alias": "size"; "required": false; "isSignal": true; }; "type": { "alias": "type"; "required": false; "isSignal": true; }; }, {}, never, never, true, [{ directive: typeof i1.HlmBtn; inputs: { "variant": "variant"; }; outputs: {}; }]>;
27
+ static ɵdir: i0.ɵɵDirectiveDeclaration<HlmInputGroupButton, "button[hlmInputGroupButton]", never, { "size": { "alias": "size"; "required": false; "isSignal": true; }; "type": { "alias": "type"; "required": false; "isSignal": true; }; "userClass": { "alias": "class"; "required": false; "isSignal": true; }; }, {}, never, never, true, [{ directive: typeof i1.HlmBtn; inputs: { "variant": "variant"; }; outputs: {}; }]>;
25
28
  }
26
29
 
27
30
  declare class HlmInputGroupInput {