@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,230 @@
1
+ import * as i0 from '@angular/core';
2
+ import { InjectionToken, inject, input, computed, Component } from '@angular/core';
3
+ import * as i1 from '@angular/forms';
4
+ import { FormGroupDirective, ReactiveFormsModule, ControlContainer } from '@angular/forms';
5
+ import { injectEgFormErrorMessages, HlmFormIdGenerator, resolveEgFormError, HlmFormField, HlmError, HlmHint } from '@egose/shadcn-theme-ng-tw/form-field';
6
+ import { HlmLabel } from '@egose/shadcn-theme-ng-tw/label';
7
+ import { formatNanpPhoneNumber, HlmPhoneInput } from '@egose/shadcn-theme-ng-tw/phone-input';
8
+ import { hlm } from '@egose/shadcn-theme-ng-tw/utils';
9
+
10
+ const EgFormPhoneInputConfigToken = new InjectionToken('EgFormPhoneInputConfig');
11
+ function provideEgFormPhoneInputConfig(config) {
12
+ return { provide: EgFormPhoneInputConfigToken, useValue: { ...config } };
13
+ }
14
+ function injectEgFormPhoneInputConfig() {
15
+ return inject(EgFormPhoneInputConfigToken, { optional: true }) ?? {};
16
+ }
17
+
18
+ class EgFormPhoneInput {
19
+ formGroupDirective = inject(FormGroupDirective);
20
+ _errorMessages = injectEgFormErrorMessages();
21
+ generatedId = inject(HlmFormIdGenerator).generate('eg-form-phone-input');
22
+ _config = injectEgFormPhoneInputConfig();
23
+ label = input(undefined, /* @ts-ignore */
24
+ ...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
25
+ controlId = input(undefined, /* @ts-ignore */
26
+ ...(ngDevMode ? [{ debugName: "controlId" }] : /* istanbul ignore next */ []));
27
+ controlName = input('', /* @ts-ignore */
28
+ ...(ngDevMode ? [{ debugName: "controlName" }] : /* istanbul ignore next */ []));
29
+ error = input(undefined, /* @ts-ignore */
30
+ ...(ngDevMode ? [{ debugName: "error" }] : /* istanbul ignore next */ []));
31
+ /**
32
+ * Auto-resolve the displayed message from the control's `ValidationErrors`
33
+ * when `error()` is unset. Explicit `error()` always wins. Set to `false`
34
+ * for manual-only messages.
35
+ */
36
+ autoError = input(true, /* @ts-ignore */
37
+ ...(ngDevMode ? [{ debugName: "autoError" }] : /* istanbul ignore next */ []));
38
+ hint = input(undefined, /* @ts-ignore */
39
+ ...(ngDevMode ? [{ debugName: "hint" }] : /* istanbul ignore next */ []));
40
+ id = input(undefined, /* @ts-ignore */
41
+ ...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
42
+ name = input(undefined, /* @ts-ignore */
43
+ ...(ngDevMode ? [{ debugName: "name" }] : /* istanbul ignore next */ []));
44
+ placeholder = input('(555) 123-4567', /* @ts-ignore */
45
+ ...(ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []));
46
+ autocomplete = input('tel', /* @ts-ignore */
47
+ ...(ngDevMode ? [{ debugName: "autocomplete" }] : /* istanbul ignore next */ []));
48
+ readonly = input(false, /* @ts-ignore */
49
+ ...(ngDevMode ? [{ debugName: "readonly" }] : /* istanbul ignore next */ []));
50
+ disabled = input(false, /* @ts-ignore */
51
+ ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
52
+ required = input(false, /* @ts-ignore */
53
+ ...(ngDevMode ? [{ debugName: "required" }] : /* istanbul ignore next */ []));
54
+ maxDigits = input(10, /* @ts-ignore */
55
+ ...(ngDevMode ? [{ debugName: "maxDigits" }] : /* istanbul ignore next */ []));
56
+ formatPhoneNumber = input(formatNanpPhoneNumber, /* @ts-ignore */
57
+ ...(ngDevMode ? [{ debugName: "formatPhoneNumber" }] : /* istanbul ignore next */ []));
58
+ modelFormat = input('digits', /* @ts-ignore */
59
+ ...(ngDevMode ? [{ debugName: "modelFormat" }] : /* istanbul ignore next */ []));
60
+ effectiveId = computed(() => this.controlId() || this.id() || this.generatedId, /* @ts-ignore */
61
+ ...(ngDevMode ? [{ debugName: "effectiveId" }] : /* istanbul ignore next */ []));
62
+ errorId = computed(() => `${this.effectiveId()}-error`, /* @ts-ignore */
63
+ ...(ngDevMode ? [{ debugName: "errorId" }] : /* istanbul ignore next */ []));
64
+ hintId = computed(() => `${this.effectiveId()}-hint`, /* @ts-ignore */
65
+ ...(ngDevMode ? [{ debugName: "hintId" }] : /* istanbul ignore next */ []));
66
+ /**
67
+ * Displayed message: explicit `error()` wins; otherwise (when `autoError()`)
68
+ * auto-resolved from the control's `ValidationErrors`. Plain method (not a
69
+ * computed): `ValidationErrors` is not a signal, so the control must be read
70
+ * fresh on every change-detection pass.
71
+ */
72
+ resolvedError() {
73
+ const explicit = this.error();
74
+ if (explicit)
75
+ return explicit;
76
+ if (!this.autoError())
77
+ return undefined;
78
+ const control = this.formGroupDirective.form.get(this.controlName());
79
+ return resolveEgFormError(control?.errors ?? null, this.label(), this._errorMessages);
80
+ }
81
+ /**
82
+ * Whether the error is surfaced: message present + control invalid +
83
+ * touched/dirty/submitted. Gates the visual `<hlm-error>` (and
84
+ * `describedBy()`, where present) so sighted and screen-reader output agree.
85
+ */
86
+ showError() {
87
+ const control = this.formGroupDirective.form.get(this.controlName());
88
+ return (!!this.resolvedError() &&
89
+ !!control?.invalid &&
90
+ (control.dirty || control.touched || this.formGroupDirective.submitted));
91
+ }
92
+ describedBy() {
93
+ return this.showError() ? this.errorId() : this.hint() ? this.hintId() : null;
94
+ }
95
+ // Styling
96
+ userClass = input('', { ...(ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {}), alias: 'class' });
97
+ labelClass = input('', /* @ts-ignore */
98
+ ...(ngDevMode ? [{ debugName: "labelClass" }] : /* istanbul ignore next */ []));
99
+ inputClass = input('', /* @ts-ignore */
100
+ ...(ngDevMode ? [{ debugName: "inputClass" }] : /* istanbul ignore next */ []));
101
+ errorClass = input('', /* @ts-ignore */
102
+ ...(ngDevMode ? [{ debugName: "errorClass" }] : /* istanbul ignore next */ []));
103
+ hintClass = input('', /* @ts-ignore */
104
+ ...(ngDevMode ? [{ debugName: "hintClass" }] : /* istanbul ignore next */ []));
105
+ // Computed classes (library base < global config < per-instance)
106
+ $userClass = computed(() => hlm('tw:w-full', this.userClass()), /* @ts-ignore */
107
+ ...(ngDevMode ? [{ debugName: "$userClass" }] : /* istanbul ignore next */ []));
108
+ $labelClass = computed(() => hlm('tw:mb-1 tw:gap-0', this._config.labelClass, this.labelClass()), /* @ts-ignore */
109
+ ...(ngDevMode ? [{ debugName: "$labelClass" }] : /* istanbul ignore next */ []));
110
+ $inputClass = computed(() => hlm('tw:mb-1', this._config.inputClass, this.inputClass()), /* @ts-ignore */
111
+ ...(ngDevMode ? [{ debugName: "$inputClass" }] : /* istanbul ignore next */ []));
112
+ $errorClass = computed(() => hlm('tw:mt-0', this._config.errorClass, this.errorClass()), /* @ts-ignore */
113
+ ...(ngDevMode ? [{ debugName: "$errorClass" }] : /* istanbul ignore next */ []));
114
+ $hintClass = computed(() => hlm('tw:mt-0', this._config.hintClass, this.hintClass()), /* @ts-ignore */
115
+ ...(ngDevMode ? [{ debugName: "$hintClass" }] : /* istanbul ignore next */ []));
116
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: EgFormPhoneInput, deps: [], target: i0.ɵɵFactoryTarget.Component });
117
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.3", type: EgFormPhoneInput, isStandalone: true, selector: "eg-form-phone-input", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, controlId: { classPropertyName: "controlId", publicName: "controlId", isSignal: true, isRequired: false, transformFunction: null }, controlName: { classPropertyName: "controlName", publicName: "controlName", isSignal: true, isRequired: false, transformFunction: null }, error: { classPropertyName: "error", publicName: "error", isSignal: true, isRequired: false, transformFunction: null }, autoError: { classPropertyName: "autoError", publicName: "autoError", isSignal: true, isRequired: false, transformFunction: null }, hint: { classPropertyName: "hint", publicName: "hint", isSignal: true, isRequired: false, transformFunction: null }, id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, autocomplete: { classPropertyName: "autocomplete", publicName: "autocomplete", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", 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 }, maxDigits: { classPropertyName: "maxDigits", publicName: "maxDigits", isSignal: true, isRequired: false, transformFunction: null }, formatPhoneNumber: { classPropertyName: "formatPhoneNumber", publicName: "formatPhoneNumber", isSignal: true, isRequired: false, transformFunction: null }, modelFormat: { classPropertyName: "modelFormat", publicName: "modelFormat", 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 }, inputClass: { classPropertyName: "inputClass", publicName: "inputClass", 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: `
118
+ @let lbl = label();
119
+ @let cnm = controlName();
120
+ @let hnt = hint();
121
+ @let rqrd = required();
122
+
123
+ <hlm-form-field>
124
+ @if (lbl) {
125
+ <label hlmLabel [for]="effectiveId()" [class]="$labelClass()"
126
+ >{{ lbl }}
127
+ @if (rqrd) {
128
+ <span class="tw:text-red-500">*</span>
129
+ }
130
+ </label>
131
+ }
132
+
133
+ <hlm-phone-input
134
+ [inputId]="effectiveId()"
135
+ [name]="cnm || name()"
136
+ [readonly]="readonly()"
137
+ [ariaLabel]="lbl"
138
+ [ariaDescribedby]="describedBy()"
139
+ [placeholder]="placeholder()"
140
+ [autocomplete]="autocomplete()"
141
+ [maxDigits]="maxDigits()"
142
+ [formatPhoneNumber]="formatPhoneNumber()"
143
+ [modelFormat]="modelFormat()"
144
+ [disabled]="disabled()"
145
+ [formControlName]="cnm"
146
+ [class]="$inputClass()"
147
+ />
148
+
149
+ @if (showError()) {
150
+ <hlm-error [id]="errorId()" [class]="$errorClass()">
151
+ {{ resolvedError() }}
152
+ </hlm-error>
153
+ }
154
+
155
+ @if (hnt) {
156
+ <hlm-hint [id]="hintId()" [class]="$hintClass()">
157
+ {{ hnt }}
158
+ </hlm-hint>
159
+ }
160
+ </hlm-form-field>
161
+ `, isInline: true, dependencies: [{ kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: HlmFormField, selector: "hlm-form-field", inputs: ["class"] }, { kind: "directive", type: HlmError, selector: "hlm-error", inputs: ["class"] }, { kind: "directive", type: HlmHint, selector: "hlm-hint", inputs: ["class"] }, { kind: "directive", type: HlmLabel, selector: "[hlmLabel]", inputs: ["class"] }, { kind: "component", type: HlmPhoneInput, selector: "hlm-phone-input", inputs: ["inputId", "name", "ariaLabel", "ariaDescribedby", "placeholder", "autocomplete", "readonly", "disabled", "forceInvalid", "maxDigits", "modelFormat", "formatPhoneNumber", "class", "inputClass"] }] });
162
+ }
163
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: EgFormPhoneInput, decorators: [{
164
+ type: Component,
165
+ args: [{
166
+ selector: 'eg-form-phone-input',
167
+ standalone: true,
168
+ host: {
169
+ '[class]': '$userClass()',
170
+ },
171
+ imports: [ReactiveFormsModule, HlmFormField, HlmError, HlmHint, HlmLabel, HlmPhoneInput],
172
+ providers: [{ provide: ControlContainer, useExisting: FormGroupDirective }],
173
+ template: `
174
+ @let lbl = label();
175
+ @let cnm = controlName();
176
+ @let hnt = hint();
177
+ @let rqrd = required();
178
+
179
+ <hlm-form-field>
180
+ @if (lbl) {
181
+ <label hlmLabel [for]="effectiveId()" [class]="$labelClass()"
182
+ >{{ lbl }}
183
+ @if (rqrd) {
184
+ <span class="tw:text-red-500">*</span>
185
+ }
186
+ </label>
187
+ }
188
+
189
+ <hlm-phone-input
190
+ [inputId]="effectiveId()"
191
+ [name]="cnm || name()"
192
+ [readonly]="readonly()"
193
+ [ariaLabel]="lbl"
194
+ [ariaDescribedby]="describedBy()"
195
+ [placeholder]="placeholder()"
196
+ [autocomplete]="autocomplete()"
197
+ [maxDigits]="maxDigits()"
198
+ [formatPhoneNumber]="formatPhoneNumber()"
199
+ [modelFormat]="modelFormat()"
200
+ [disabled]="disabled()"
201
+ [formControlName]="cnm"
202
+ [class]="$inputClass()"
203
+ />
204
+
205
+ @if (showError()) {
206
+ <hlm-error [id]="errorId()" [class]="$errorClass()">
207
+ {{ resolvedError() }}
208
+ </hlm-error>
209
+ }
210
+
211
+ @if (hnt) {
212
+ <hlm-hint [id]="hintId()" [class]="$hintClass()">
213
+ {{ hnt }}
214
+ </hlm-hint>
215
+ }
216
+ </hlm-form-field>
217
+ `,
218
+ }]
219
+ }], propDecorators: { label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], controlId: [{ type: i0.Input, args: [{ isSignal: true, alias: "controlId", required: false }] }], controlName: [{ type: i0.Input, args: [{ isSignal: true, alias: "controlName", required: false }] }], error: [{ type: i0.Input, args: [{ isSignal: true, alias: "error", required: false }] }], autoError: [{ type: i0.Input, args: [{ isSignal: true, alias: "autoError", required: false }] }], hint: [{ type: i0.Input, args: [{ isSignal: true, alias: "hint", required: false }] }], id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], name: [{ type: i0.Input, args: [{ isSignal: true, alias: "name", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], autocomplete: [{ type: i0.Input, args: [{ isSignal: true, alias: "autocomplete", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }], maxDigits: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxDigits", required: false }] }], formatPhoneNumber: [{ type: i0.Input, args: [{ isSignal: true, alias: "formatPhoneNumber", required: false }] }], modelFormat: [{ type: i0.Input, args: [{ isSignal: true, alias: "modelFormat", required: false }] }], userClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], labelClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "labelClass", required: false }] }], inputClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "inputClass", required: false }] }], errorClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "errorClass", required: false }] }], hintClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "hintClass", required: false }] }] } });
220
+
221
+ /*
222
+ * Public API Surface of form-phone-input
223
+ */
224
+
225
+ /**
226
+ * Generated bundle index. Do not edit.
227
+ */
228
+
229
+ export { EgFormPhoneInput, injectEgFormPhoneInputConfig, provideEgFormPhoneInputConfig };
230
+
@@ -0,0 +1,24 @@
1
+ {
2
+ "name": "form-phone-input",
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-phone-input.mjs",
13
+ "typings": "types/form-phone-input.d.ts",
14
+ "exports": {
15
+ "./package.json": {
16
+ "default": "./package.json"
17
+ },
18
+ ".": {
19
+ "types": "./types/form-phone-input.d.ts",
20
+ "default": "./fesm2022/form-phone-input.mjs"
21
+ }
22
+ },
23
+ "type": "module"
24
+ }
@@ -0,0 +1,78 @@
1
+ import * as _angular_core from '@angular/core';
2
+ import { ValueProvider } from '@angular/core';
3
+ import { PhoneNumberFormatter } from '@egose/shadcn-theme-ng-tw/phone-input';
4
+ import { ClassValue } from 'clsx';
5
+
6
+ declare class EgFormPhoneInput {
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
+ name: _angular_core.InputSignal<string | undefined>;
24
+ placeholder: _angular_core.InputSignal<string>;
25
+ autocomplete: _angular_core.InputSignal<string>;
26
+ readonly: _angular_core.InputSignal<boolean>;
27
+ disabled: _angular_core.InputSignal<boolean>;
28
+ required: _angular_core.InputSignal<boolean>;
29
+ maxDigits: _angular_core.InputSignal<number>;
30
+ formatPhoneNumber: _angular_core.InputSignal<PhoneNumberFormatter>;
31
+ modelFormat: _angular_core.InputSignal<"digits" | "formatted">;
32
+ readonly effectiveId: _angular_core.Signal<string>;
33
+ readonly errorId: _angular_core.Signal<string>;
34
+ readonly hintId: _angular_core.Signal<string>;
35
+ /**
36
+ * Displayed message: explicit `error()` wins; otherwise (when `autoError()`)
37
+ * auto-resolved from the control's `ValidationErrors`. Plain method (not a
38
+ * computed): `ValidationErrors` is not a signal, so the control must be read
39
+ * fresh on every change-detection pass.
40
+ */
41
+ protected resolvedError(): string | undefined;
42
+ /**
43
+ * Whether the error is surfaced: message present + control invalid +
44
+ * touched/dirty/submitted. Gates the visual `<hlm-error>` (and
45
+ * `describedBy()`, where present) so sighted and screen-reader output agree.
46
+ */
47
+ protected showError(): boolean;
48
+ describedBy(): string | null;
49
+ userClass: _angular_core.InputSignal<ClassValue>;
50
+ labelClass: _angular_core.InputSignal<string>;
51
+ inputClass: _angular_core.InputSignal<string>;
52
+ errorClass: _angular_core.InputSignal<string>;
53
+ hintClass: _angular_core.InputSignal<string>;
54
+ $userClass: _angular_core.Signal<string>;
55
+ $labelClass: _angular_core.Signal<string>;
56
+ $inputClass: _angular_core.Signal<string>;
57
+ $errorClass: _angular_core.Signal<string>;
58
+ $hintClass: _angular_core.Signal<string>;
59
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<EgFormPhoneInput, never>;
60
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<EgFormPhoneInput, "eg-form-phone-input", never, { "label": { "alias": "label"; "required": false; "isSignal": true; }; "controlId": { "alias": "controlId"; "required": false; "isSignal": true; }; "controlName": { "alias": "controlName"; "required": false; "isSignal": true; }; "error": { "alias": "error"; "required": false; "isSignal": true; }; "autoError": { "alias": "autoError"; "required": false; "isSignal": true; }; "hint": { "alias": "hint"; "required": false; "isSignal": true; }; "id": { "alias": "id"; "required": false; "isSignal": true; }; "name": { "alias": "name"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "autocomplete": { "alias": "autocomplete"; "required": false; "isSignal": true; }; "readonly": { "alias": "readonly"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "required": { "alias": "required"; "required": false; "isSignal": true; }; "maxDigits": { "alias": "maxDigits"; "required": false; "isSignal": true; }; "formatPhoneNumber": { "alias": "formatPhoneNumber"; "required": false; "isSignal": true; }; "modelFormat": { "alias": "modelFormat"; "required": false; "isSignal": true; }; "userClass": { "alias": "class"; "required": false; "isSignal": true; }; "labelClass": { "alias": "labelClass"; "required": false; "isSignal": true; }; "inputClass": { "alias": "inputClass"; "required": false; "isSignal": true; }; "errorClass": { "alias": "errorClass"; "required": false; "isSignal": true; }; "hintClass": { "alias": "hintClass"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
61
+ }
62
+
63
+ interface EgFormPhoneInputConfig {
64
+ /**
65
+ * Global class defaults for `eg-form-phone-input` styling slots.
66
+ * Each is merged under the matching per-instance `*Class` input
67
+ * (library base < global config < per-instance).
68
+ */
69
+ labelClass?: string;
70
+ inputClass?: string;
71
+ errorClass?: string;
72
+ hintClass?: string;
73
+ }
74
+ declare function provideEgFormPhoneInputConfig(config: Partial<EgFormPhoneInputConfig>): ValueProvider;
75
+ declare function injectEgFormPhoneInputConfig(): EgFormPhoneInputConfig;
76
+
77
+ export { EgFormPhoneInput, injectEgFormPhoneInputConfig, provideEgFormPhoneInputConfig };
78
+ export type { EgFormPhoneInputConfig };
@@ -0,0 +1,199 @@
1
+ # Form Radio Group (`@egose/shadcn-theme-ng/form-radio-group`)
2
+
3
+ A ready-made reactive-form radio field: group label + `hlm-radio-group` options + validation error/hint display in one tag.
4
+
5
+ The Angular implementation is a standalone wrapper: it renders `HlmFormField` / `HlmError` / `HlmHint` from `@egose/shadcn-theme-ng/form-field`, `HlmLabel`, and `HlmRadioGroup` / `HlmRadio` / `HlmRadioIndicator` from `@egose/shadcn-theme-ng/radio-group`. The group is bound with `[formControlName]="controlName()"`, so the parent `FormGroup` owns the `string` value. It must live inside a `FormGroupDirective` (`[formGroup]` parent); ids come from `HlmFormIdGenerator` unless overridden.
6
+
7
+ > **Ships as:** `@egose/shadcn-theme-ng/form-radio-group` and `@egose/shadcn-theme-ng-tw/form-radio-group`
8
+ > (the `tw:`-prefixed Tailwind variant). Both expose the identical TypeScript surface; only the
9
+ > emitted Tailwind class strings differ. See the [package README](../../README.md) for install
10
+ > steps, peer dependencies, and Tailwind setup. Do not publish this project directory independently.
11
+
12
+ ## Installation
13
+
14
+ ```bash
15
+ # Plain Tailwind (no prefix)
16
+ npm install @egose/shadcn-theme-ng
17
+
18
+ # tw:-prefixed Tailwind variant
19
+ npm install @egose/shadcn-theme-ng-tw
20
+ ```
21
+
22
+ Peer dependencies (Angular, `@spartan-ng/brain`, `rxjs`, …) are documented in the
23
+ [package README](../../README.md#peer-dependencies). This subpath additionally relies at runtime on
24
+ `@egose/shadcn-theme-ng/radio-group`, `@egose/shadcn-theme-ng/form-field`, and
25
+ `@egose/shadcn-theme-ng/label`.
26
+
27
+ ## Imports
28
+
29
+ Exported from the subpath root (`projects/form-radio-group/src/public-api.ts`):
30
+
31
+ ```ts
32
+ import { EgFormRadioGroup, provideEgFormRadioGroupConfig } from '@egose/shadcn-theme-ng/form-radio-group';
33
+ // tw variant: replace with '@egose/shadcn-theme-ng-tw/form-radio-group'
34
+ ```
35
+
36
+ Standalone usage:
37
+
38
+ ```ts
39
+ import { Component } from '@angular/core';
40
+ import { ReactiveFormsModule } from '@angular/forms';
41
+ import { EgFormRadioGroup } from '@egose/shadcn-theme-ng/form-radio-group';
42
+
43
+ @Component({
44
+ selector: 'app-demo',
45
+ standalone: true,
46
+ imports: [ReactiveFormsModule, EgFormRadioGroup],
47
+ template: `...`,
48
+ })
49
+ export class DemoComponent {}
50
+ ```
51
+
52
+ NgModule-based consumer: add `EgFormRadioGroup` (and `ReactiveFormsModule`) to the module's
53
+ `imports` — it is a standalone component, not a module.
54
+
55
+ `ControlValueAccessor` behavior: `eg-form-radio-group` itself is not a `ControlValueAccessor`; the
56
+ inner `hlm-radio-group` is (bound via `formControlName`), so `formControlName`/`formGroup` handling,
57
+ `Validators`, and `disabled` state from the control all flow through the parent form.
58
+
59
+ ## Anatomy / Structure
60
+
61
+ ```html
62
+ <form [formGroup]="form">
63
+ <eg-form-radio-group controlName="plan" label="Plan" [options]="plans" [required]="true" error="Plan is required." />
64
+ </form>
65
+ ```
66
+
67
+ Selector (from source): `eg-form-radio-group` (standalone component, host `tw:w-full`).
68
+
69
+ ## API reference
70
+
71
+ ### `EgFormRadioGroup` — `eg-form-radio-group`
72
+
73
+ | Input | Type | Default | Description |
74
+ | ------------- | ------------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
75
+ | `controlName` | `string` | `''` | `formControlName` key inside the parent `FormGroup`. **Required.** |
76
+ | `label` | `string \| undefined` | — | Group label text (hidden when omitted). |
77
+ | `error` | `string \| undefined` | — | Error text shown when invalid. |
78
+ | `autoError` | `boolean` | `true` | Auto-resolve the message from the control's `ValidationErrors` when `error` is unset. Explicit `error` always wins; `error=""` counts as unset. Global wording via `provideEgFormErrorMessages`. |
79
+ | `hint` | `string \| undefined` | — | Hint text shown otherwise. |
80
+ | `controlId` | `string \| undefined` | — | Explicit id prefix (first priority for `effectiveId`). |
81
+ | `id` | `string \| undefined` | — | Fallback id prefix (second priority). |
82
+ | `name` | `string \| undefined` | — | Native group `name` (`controlName` wins when set). |
83
+ | `disabled` | `boolean` | `false` | Locks interaction (form control stays enabled). |
84
+ | `required` | `boolean` | `false` | Shows a red `*` next to the label; forwarded to the group. |
85
+ | `options` | `{ value, label, disabled? }[]` | `[]` | Rendered as labelled `hlm-radio` options. |
86
+ | `class` | `ClassValue` | `''` | Extra host classes (base `tw:w-full`). |
87
+ | `labelClass` | `string` | `''` | Extra group-label classes (base `tw:mb-1`). |
88
+ | `groupClass` | `string` | `''` | Extra group classes (base `tw:flex tw:flex-col tw:gap-2`). |
89
+ | `errorClass` | `string` | `''` | Extra error classes (base `tw:mt-0`). |
90
+ | `hintClass` | `string` | `''` | Extra hint classes (base `tw:mt-0`). |
91
+
92
+ | Member | Description |
93
+ | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
94
+ | `effectiveId` | `controlId() \|\| id() \|\| generated` — id prefix for `errorId` / `hintId`. |
95
+ | `errorId` / `hintId` | `effectiveId + '-error' / '-hint'`. |
96
+ | `describedBy()` | `errorId` when `error()` is set and control is invalid + dirty/touched, else `hintId` when `hint()` is set, else `null` — wired to each radio's `aria-describedby`. |
97
+
98
+ Each option renders inside a native `<label>`, so every radio is implicitly labelled by its option text. Requires a `[formGroup]` ancestor (injects `FormGroupDirective`, provides `ControlContainer → FormGroupDirective`).
99
+
100
+ ## Examples
101
+
102
+ ### 1. Basic required group
103
+
104
+ ```ts
105
+ import { Component, inject } from '@angular/core';
106
+ import { FormBuilder, ReactiveFormsModule, Validators } from '@angular/forms';
107
+ import { EgFormRadioGroup } from '@egose/shadcn-theme-ng/form-radio-group';
108
+
109
+ @Component({
110
+ selector: 'app-plan',
111
+ standalone: true,
112
+ imports: [ReactiveFormsModule, EgFormRadioGroup],
113
+ template: `
114
+ <form [formGroup]="form" (ngSubmit)="submit()">
115
+ <eg-form-radio-group
116
+ controlName="plan"
117
+ label="Plan"
118
+ [options]="plans"
119
+ [required]="true"
120
+ error="Plan is required."
121
+ />
122
+ <button type="submit" [disabled]="form.invalid">Continue</button>
123
+ </form>
124
+ `,
125
+ })
126
+ export class PlanComponent {
127
+ private readonly fb = inject(FormBuilder);
128
+ readonly form = this.fb.group({ plan: ['', Validators.required] });
129
+ readonly plans = [
130
+ { value: 'starter', label: 'Starter' },
131
+ { value: 'pro', label: 'Pro' },
132
+ { value: 'enterprise', label: 'Enterprise', disabled: true },
133
+ ];
134
+ submit() {
135
+ console.log(this.form.value.plan);
136
+ }
137
+ }
138
+ ```
139
+
140
+ ### 2. Hint + horizontal layout
141
+
142
+ ```ts
143
+ import { Component, inject } from '@angular/core';
144
+ import { FormBuilder, ReactiveFormsModule } from '@angular/forms';
145
+ import { EgFormRadioGroup } from '@egose/shadcn-theme-ng/form-radio-group';
146
+
147
+ @Component({
148
+ selector: 'app-billing',
149
+ standalone: true,
150
+ imports: [ReactiveFormsModule, EgFormRadioGroup],
151
+ template: `
152
+ <form [formGroup]="form">
153
+ <eg-form-radio-group
154
+ controlName="cycle"
155
+ label="Billing cycle"
156
+ [options]="cycles"
157
+ groupClass="tw:flex-row tw:gap-4"
158
+ hint="Switch or cancel anytime."
159
+ />
160
+ </form>
161
+ `,
162
+ })
163
+ export class BillingComponent {
164
+ private readonly fb = inject(FormBuilder);
165
+ readonly form = this.fb.group({ cycle: ['monthly'] });
166
+ readonly cycles = [
167
+ { value: 'monthly', label: 'Monthly' },
168
+ { value: 'yearly', label: 'Yearly' },
169
+ ];
170
+ }
171
+ ```
172
+
173
+ ## Accessibility notes
174
+
175
+ - Each radio is wrapped in a native `<label>` with its option text (implicit association), and receives `aria-describedby` (error/hint id) — the group label is visual.
176
+ - The required `*` is visual; pair with `Validators.required` so assistive tech and validation agree.
177
+
178
+ ## Theming / CSS variables
179
+
180
+ No component-specific CSS variables. Style per-instance via `class` / `labelClass` / `groupClass` / `errorClass` / `hintClass` (precedence: library base < global config < per-instance).
181
+
182
+ Global defaults per styling slot via the wrapper config:
183
+
184
+ ```ts
185
+ import { provideEgFormRadioGroupConfig } from '@egose/shadcn-theme-ng/form-radio-group';
186
+
187
+ await bootstrapApplication(App, {
188
+ providers: [provideEgFormRadioGroupConfig({ groupClass: 'tw:gap-3', labelClass: 'tw:font-medium' })],
189
+ });
190
+ ```
191
+
192
+ The host keeps `tw:w-full`; constrain width with `class` or a wrapping container.
193
+
194
+ ## Related subpaths
195
+
196
+ - `@egose/shadcn-theme-ng/radio-group` — raw `hlm-radio-group` / `hlm-radio` / `hlm-radio-indicator` for custom layouts.
197
+ - `@egose/shadcn-theme-ng/form-select` — single-choice alternative with a popover (`eg-form-select`).
198
+ - `@egose/shadcn-theme-ng/form-field` — `hlm-form-field` / `hlm-error` / `hlm-hint` used internally.
199
+ - `@egose/shadcn-theme-ng/form-field-simple` — alternative minimal wrapper when you compose controls by hand.