@egose/shadcn-theme-ng 0.2.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (96) hide show
  1. package/README.md +1 -1
  2. package/autocomplete/fesm2022/autocomplete.mjs +1 -1
  3. package/checkbox/fesm2022/checkbox.mjs +6 -7
  4. package/checkbox/types/checkbox.d.ts +1 -1
  5. package/combobox/fesm2022/combobox.mjs +1 -1
  6. package/date-picker/README.md +15 -11
  7. package/date-picker/fesm2022/date-picker.mjs +148 -30
  8. package/date-picker/types/date-picker.d.ts +102 -9
  9. package/form-autocomplete/README.md +178 -0
  10. package/form-autocomplete/fesm2022/form-autocomplete.mjs +159 -0
  11. package/form-autocomplete/package.json +24 -0
  12. package/form-autocomplete/types/form-autocomplete.d.ts +81 -0
  13. package/form-checkbox/README.md +29 -18
  14. package/form-checkbox/fesm2022/form-checkbox.mjs +59 -17
  15. package/form-checkbox/types/form-checkbox.d.ts +43 -4
  16. package/form-combobox/README.md +203 -0
  17. package/form-combobox/fesm2022/form-combobox.mjs +181 -0
  18. package/form-combobox/package.json +24 -0
  19. package/form-combobox/types/form-combobox.d.ts +93 -0
  20. package/form-date-picker/README.md +49 -22
  21. package/form-date-picker/fesm2022/form-date-picker.mjs +74 -19
  22. package/form-date-picker/types/form-date-picker.d.ts +37 -1
  23. package/form-date-picker-multi/README.md +192 -0
  24. package/form-date-picker-multi/fesm2022/form-date-picker-multi.mjs +158 -0
  25. package/form-date-picker-multi/package.json +24 -0
  26. package/form-date-picker-multi/types/form-date-picker-multi.d.ts +78 -0
  27. package/form-date-range-picker/README.md +254 -0
  28. package/form-date-range-picker/fesm2022/form-date-range-picker.mjs +159 -0
  29. package/form-date-range-picker/package.json +24 -0
  30. package/form-date-range-picker/types/form-date-range-picker.d.ts +75 -0
  31. package/form-field/README.md +9 -0
  32. package/form-field/fesm2022/form-field.mjs +80 -5
  33. package/form-field/types/form-field.d.ts +50 -2
  34. package/form-field-simple/fesm2022/form-field-simple.mjs +15 -1
  35. package/form-field-simple/types/form-field-simple.d.ts +9 -2
  36. package/form-input-otp/README.md +195 -0
  37. package/form-input-otp/fesm2022/form-input-otp.mjs +140 -0
  38. package/form-input-otp/package.json +24 -0
  39. package/form-input-otp/types/form-input-otp.d.ts +78 -0
  40. package/form-month-year-picker/README.md +189 -0
  41. package/form-month-year-picker/fesm2022/form-month-year-picker.mjs +154 -0
  42. package/form-month-year-picker/package.json +24 -0
  43. package/form-month-year-picker/types/form-month-year-picker.d.ts +73 -0
  44. package/form-native-select/README.md +206 -0
  45. package/form-native-select/fesm2022/form-native-select.mjs +132 -0
  46. package/form-native-select/package.json +24 -0
  47. package/form-native-select/types/form-native-select.d.ts +77 -0
  48. package/form-phone-input/README.md +189 -0
  49. package/form-phone-input/fesm2022/form-phone-input.mjs +142 -0
  50. package/form-phone-input/package.json +24 -0
  51. package/form-phone-input/types/form-phone-input.d.ts +78 -0
  52. package/form-radio-group/README.md +199 -0
  53. package/form-radio-group/fesm2022/form-radio-group.mjs +140 -0
  54. package/form-radio-group/package.json +24 -0
  55. package/form-radio-group/types/form-radio-group.d.ts +83 -0
  56. package/form-searchable-multiselect/README.md +28 -17
  57. package/form-searchable-multiselect/fesm2022/form-searchable-multiselect.mjs +57 -19
  58. package/form-searchable-multiselect/types/form-searchable-multiselect.d.ts +39 -2
  59. package/form-select/README.md +30 -19
  60. package/form-select/fesm2022/form-select.mjs +57 -19
  61. package/form-select/types/form-select.d.ts +39 -2
  62. package/form-slider/README.md +183 -0
  63. package/form-slider/fesm2022/form-slider.mjs +140 -0
  64. package/form-slider/package.json +24 -0
  65. package/form-slider/types/form-slider.d.ts +80 -0
  66. package/form-switch/README.md +174 -0
  67. package/form-switch/fesm2022/form-switch.mjs +129 -0
  68. package/form-switch/package.json +24 -0
  69. package/form-switch/types/form-switch.d.ts +70 -0
  70. package/form-text-input/README.md +37 -26
  71. package/form-text-input/fesm2022/form-text-input.mjs +57 -19
  72. package/form-text-input/types/form-text-input.d.ts +39 -2
  73. package/form-textarea/README.md +33 -22
  74. package/form-textarea/fesm2022/form-textarea.mjs +57 -19
  75. package/form-textarea/types/form-textarea.d.ts +39 -2
  76. package/form-toggle/README.md +187 -0
  77. package/form-toggle/fesm2022/form-toggle.mjs +193 -0
  78. package/form-toggle/package.json +24 -0
  79. package/form-toggle/types/form-toggle.d.ts +100 -0
  80. package/form-toggle-group/README.md +177 -0
  81. package/form-toggle-group/fesm2022/form-toggle-group.mjs +145 -0
  82. package/form-toggle-group/package.json +24 -0
  83. package/form-toggle-group/types/form-toggle-group.d.ts +85 -0
  84. package/input-group/fesm2022/input-group.mjs +19 -9
  85. package/input-group/types/input-group.d.ts +4 -1
  86. package/native-select/fesm2022/native-select.mjs +18 -6
  87. package/native-select/types/native-select.d.ts +7 -2
  88. package/package.json +57 -1
  89. package/phone-input/README.md +114 -0
  90. package/phone-input/fesm2022/phone-input.mjs +191 -0
  91. package/phone-input/package.json +24 -0
  92. package/phone-input/types/phone-input.d.ts +67 -0
  93. package/radio-group/types/radio-group.d.ts +1 -1
  94. package/switch/fesm2022/switch.mjs +7 -5
  95. package/switch/types/switch.d.ts +2 -1
  96. package/typography/types/typography.d.ts +8 -8
@@ -0,0 +1,154 @@
1
+ import * as i0 from '@angular/core';
2
+ import { inject, input, computed, Component } from '@angular/core';
3
+ import * as i1 from '@angular/forms';
4
+ import { FormGroupDirective, ReactiveFormsModule, ControlContainer } from '@angular/forms';
5
+ import { injectEgFormErrorMessages, HlmFormIdGenerator, resolveEgFormError, HlmFormField, HlmError, HlmHint } from '@egose/shadcn-theme-ng/form-field';
6
+ import { HlmLabel } from '@egose/shadcn-theme-ng/label';
7
+ import { injectHlmMonthYearPickerConfig, HlmMonthYearPicker, HlmMonthYearInput } from '@egose/shadcn-theme-ng/date-picker';
8
+ import { hlm } from '@egose/shadcn-theme-ng/utils';
9
+
10
+ class EgFormMonthYearPicker {
11
+ formGroupDirective = inject(FormGroupDirective);
12
+ _errorMessages = injectEgFormErrorMessages();
13
+ generatedId = inject(HlmFormIdGenerator).generate('eg-form-month-year-picker');
14
+ _config = injectHlmMonthYearPickerConfig();
15
+ label = input(undefined, /* @ts-ignore */
16
+ ...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
17
+ controlId = input(undefined, /* @ts-ignore */
18
+ ...(ngDevMode ? [{ debugName: "controlId" }] : /* istanbul ignore next */ []));
19
+ controlName = input('', /* @ts-ignore */
20
+ ...(ngDevMode ? [{ debugName: "controlName" }] : /* istanbul ignore next */ []));
21
+ error = input(undefined, /* @ts-ignore */
22
+ ...(ngDevMode ? [{ debugName: "error" }] : /* istanbul ignore next */ []));
23
+ /**
24
+ * Auto-resolve the displayed message from the control's `ValidationErrors`
25
+ * when `error()` is unset. Explicit `error()` always wins. Set to `false`
26
+ * for manual-only messages.
27
+ */
28
+ autoError = input(true, /* @ts-ignore */
29
+ ...(ngDevMode ? [{ debugName: "autoError" }] : /* istanbul ignore next */ []));
30
+ hint = input(undefined, /* @ts-ignore */
31
+ ...(ngDevMode ? [{ debugName: "hint" }] : /* istanbul ignore next */ []));
32
+ id = input(undefined, /* @ts-ignore */
33
+ ...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
34
+ name = input(undefined, /* @ts-ignore */
35
+ ...(ngDevMode ? [{ debugName: "name" }] : /* istanbul ignore next */ []));
36
+ placeholder = input('MM/YYYY', /* @ts-ignore */
37
+ ...(ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []));
38
+ readonly = input(false, /* @ts-ignore */
39
+ ...(ngDevMode ? [{ debugName: "readonly" }] : /* istanbul ignore next */ []));
40
+ disabled = input(false, /* @ts-ignore */
41
+ ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
42
+ required = input(false, /* @ts-ignore */
43
+ ...(ngDevMode ? [{ debugName: "required" }] : /* istanbul ignore next */ []));
44
+ min = input(null, /* @ts-ignore */
45
+ ...(ngDevMode ? [{ debugName: "min" }] : /* istanbul ignore next */ []));
46
+ max = input(null, /* @ts-ignore */
47
+ ...(ngDevMode ? [{ debugName: "max" }] : /* istanbul ignore next */ []));
48
+ // Picker behavior (defaults fall back to the injected HlmMonthYearPickerConfig)
49
+ autoCloseOnSelect = input(this._config.autoCloseOnSelect, /* @ts-ignore */
50
+ ...(ngDevMode ? [{ debugName: "autoCloseOnSelect" }] : /* istanbul ignore next */ []));
51
+ formatDate = input(this._config.formatDate, /* @ts-ignore */
52
+ ...(ngDevMode ? [{ debugName: "formatDate" }] : /* istanbul ignore next */ []));
53
+ transformDate = input(this._config.transformDate, /* @ts-ignore */
54
+ ...(ngDevMode ? [{ debugName: "transformDate" }] : /* istanbul ignore next */ []));
55
+ parseDate = input(this._config.parseDate, /* @ts-ignore */
56
+ ...(ngDevMode ? [{ debugName: "parseDate" }] : /* istanbul ignore next */ []));
57
+ formatInputDate = input(this._config.formatInputDate, /* @ts-ignore */
58
+ ...(ngDevMode ? [{ debugName: "formatInputDate" }] : /* istanbul ignore next */ []));
59
+ effectiveId = computed(() => this.controlId() || this.id() || this.generatedId, /* @ts-ignore */
60
+ ...(ngDevMode ? [{ debugName: "effectiveId" }] : /* istanbul ignore next */ []));
61
+ errorId = computed(() => `${this.effectiveId()}-error`, /* @ts-ignore */
62
+ ...(ngDevMode ? [{ debugName: "errorId" }] : /* istanbul ignore next */ []));
63
+ hintId = computed(() => `${this.effectiveId()}-hint`, /* @ts-ignore */
64
+ ...(ngDevMode ? [{ debugName: "hintId" }] : /* istanbul ignore next */ []));
65
+ /**
66
+ * Displayed message: explicit `error()` wins; otherwise (when `autoError()`)
67
+ * auto-resolved from the control's `ValidationErrors`. Plain method (not a
68
+ * computed): `ValidationErrors` is not a signal, so the control must be read
69
+ * fresh on every change-detection pass.
70
+ */
71
+ resolvedError() {
72
+ const explicit = this.error();
73
+ if (explicit)
74
+ return explicit;
75
+ if (!this.autoError())
76
+ return undefined;
77
+ const control = this.formGroupDirective.form.get(this.controlName());
78
+ return resolveEgFormError(control?.errors ?? null, this.label(), this._errorMessages);
79
+ }
80
+ /**
81
+ * Whether the error is surfaced: message present + control invalid +
82
+ * touched/dirty/submitted. Gates the visual `<hlm-error>` (and
83
+ * `describedBy()`, where present) so sighted and screen-reader output agree.
84
+ */
85
+ showError() {
86
+ const control = this.formGroupDirective.form.get(this.controlName());
87
+ return (!!this.resolvedError() &&
88
+ !!control?.invalid &&
89
+ (control.dirty || control.touched || this.formGroupDirective.submitted));
90
+ }
91
+ /**
92
+ * Bounds projected onto the picker's `Date` model. The cast keeps the
93
+ * template's generic inference on `Date` while passing runtime values
94
+ * through untouched.
95
+ */
96
+ $min = computed(() => this.min(), /* @ts-ignore */
97
+ ...(ngDevMode ? [{ debugName: "$min" }] : /* istanbul ignore next */ []));
98
+ $max = computed(() => this.max(), /* @ts-ignore */
99
+ ...(ngDevMode ? [{ debugName: "$max" }] : /* istanbul ignore next */ []));
100
+ describedBy() {
101
+ return this.showError() ? this.errorId() : this.hint() ? this.hintId() : null;
102
+ }
103
+ // Styling
104
+ userClass = input('', { ...(ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {}), alias: 'class' });
105
+ labelClass = input('', /* @ts-ignore */
106
+ ...(ngDevMode ? [{ debugName: "labelClass" }] : /* istanbul ignore next */ []));
107
+ pickerClass = input('', /* @ts-ignore */
108
+ ...(ngDevMode ? [{ debugName: "pickerClass" }] : /* istanbul ignore next */ []));
109
+ inputClass = input('', /* @ts-ignore */
110
+ ...(ngDevMode ? [{ debugName: "inputClass" }] : /* istanbul ignore next */ []));
111
+ errorClass = input('', /* @ts-ignore */
112
+ ...(ngDevMode ? [{ debugName: "errorClass" }] : /* istanbul ignore next */ []));
113
+ hintClass = input('', /* @ts-ignore */
114
+ ...(ngDevMode ? [{ debugName: "hintClass" }] : /* istanbul ignore next */ []));
115
+ // Computed classes (library base < global config < per-instance)
116
+ $userClass = computed(() => hlm("w-full", this.userClass()), /* @ts-ignore */
117
+ ...(ngDevMode ? [{ debugName: "$userClass" }] : /* istanbul ignore next */ []));
118
+ $labelClass = computed(() => hlm("mb-1", this._config.labelClass, this.labelClass()), /* @ts-ignore */
119
+ ...(ngDevMode ? [{ debugName: "$labelClass" }] : /* istanbul ignore next */ []));
120
+ $pickerClass = computed(() => hlm("mb-1", this._config.pickerClass, this.pickerClass()), /* @ts-ignore */
121
+ ...(ngDevMode ? [{ debugName: "$pickerClass" }] : /* istanbul ignore next */ []));
122
+ $inputClass = computed(() => hlm(this._config.inputClass, this.inputClass()), /* @ts-ignore */
123
+ ...(ngDevMode ? [{ debugName: "$inputClass" }] : /* istanbul ignore next */ []));
124
+ $errorClass = computed(() => hlm("mt-0", this._config.errorClass, this.errorClass()), /* @ts-ignore */
125
+ ...(ngDevMode ? [{ debugName: "$errorClass" }] : /* istanbul ignore next */ []));
126
+ $hintClass = computed(() => hlm("mt-0", this._config.hintClass, this.hintClass()), /* @ts-ignore */
127
+ ...(ngDevMode ? [{ debugName: "$hintClass" }] : /* istanbul ignore next */ []));
128
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: EgFormMonthYearPicker, deps: [], target: i0.ɵɵFactoryTarget.Component });
129
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.3", type: EgFormMonthYearPicker, isStandalone: true, selector: "eg-form-month-year-picker", 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 }, 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 }, min: { classPropertyName: "min", publicName: "min", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, autoCloseOnSelect: { classPropertyName: "autoCloseOnSelect", publicName: "autoCloseOnSelect", isSignal: true, isRequired: false, transformFunction: null }, formatDate: { classPropertyName: "formatDate", publicName: "formatDate", isSignal: true, isRequired: false, transformFunction: null }, transformDate: { classPropertyName: "transformDate", publicName: "transformDate", isSignal: true, isRequired: false, transformFunction: null }, parseDate: { classPropertyName: "parseDate", publicName: "parseDate", isSignal: true, isRequired: false, transformFunction: null }, formatInputDate: { classPropertyName: "formatInputDate", publicName: "formatInputDate", 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 }, pickerClass: { classPropertyName: "pickerClass", publicName: "pickerClass", 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: "\n @let lbl = label();\n @let cnm = controlName();\n @let hnt = hint();\n @let rqrd = required();\n\n <hlm-form-field>\n @if (lbl) {\n <label hlmLabel [for]=\"effectiveId()\" [class]=\"$labelClass()\"\n >{{ lbl }}\n @if (rqrd) {\n <span class=\"text-red-500\">*</span>\n }\n </label>\n }\n\n <hlm-month-year-picker\n [min]=\"$min()\"\n [max]=\"$max()\"\n [disabled]=\"disabled()\"\n [autoCloseOnSelect]=\"autoCloseOnSelect()\"\n [formatDate]=\"formatDate()\"\n [transformDate]=\"transformDate()\"\n [formControlName]=\"cnm\"\n [class]=\"$pickerClass()\"\n >\n <hlm-month-year-input\n [inputId]=\"effectiveId()\"\n [name]=\"cnm || name()\"\n [readonly]=\"readonly()\"\n [ariaLabel]=\"lbl\"\n [ariaDescribedby]=\"describedBy()\"\n [placeholder]=\"placeholder()\"\n [parseDate]=\"parseDate()\"\n [formatInputDate]=\"formatInputDate()\"\n [inputClass]=\"$inputClass()\"\n />\n </hlm-month-year-picker>\n\n @if (showError()) {\n <hlm-error [id]=\"errorId()\" [class]=\"$errorClass()\">\n {{ resolvedError() }}\n </hlm-error>\n }\n\n @if (hnt) {\n <hlm-hint [id]=\"hintId()\" [class]=\"$hintClass()\">\n {{ hnt }}\n </hlm-hint>\n }\n </hlm-form-field>\n ", isInline: true, dependencies: [{ kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.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: HlmMonthYearPicker, selector: "hlm-month-year-picker", inputs: ["min", "max", "disabled", "date", "defaultFocusedDate", "autoCloseOnSelect", "formatDate", "transformDate"], outputs: ["dateChange"] }, { kind: "component", type: HlmMonthYearInput, selector: "hlm-month-year-input", inputs: ["name", "readonly", "ariaLabel", "ariaDescribedby", "class", "inputClass", "parseDate", "formatInputDate"] }] });
130
+ }
131
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: EgFormMonthYearPicker, decorators: [{
132
+ type: Component,
133
+ args: [{
134
+ selector: 'eg-form-month-year-picker',
135
+ standalone: true,
136
+ host: {
137
+ '[class]': '$userClass()',
138
+ },
139
+ imports: [ReactiveFormsModule, HlmFormField, HlmError, HlmHint, HlmLabel, HlmMonthYearPicker, HlmMonthYearInput],
140
+ providers: [{ provide: ControlContainer, useExisting: FormGroupDirective }],
141
+ template: "\n @let lbl = label();\n @let cnm = controlName();\n @let hnt = hint();\n @let rqrd = required();\n\n <hlm-form-field>\n @if (lbl) {\n <label hlmLabel [for]=\"effectiveId()\" [class]=\"$labelClass()\"\n >{{ lbl }}\n @if (rqrd) {\n <span class=\"text-red-500\">*</span>\n }\n </label>\n }\n\n <hlm-month-year-picker\n [min]=\"$min()\"\n [max]=\"$max()\"\n [disabled]=\"disabled()\"\n [autoCloseOnSelect]=\"autoCloseOnSelect()\"\n [formatDate]=\"formatDate()\"\n [transformDate]=\"transformDate()\"\n [formControlName]=\"cnm\"\n [class]=\"$pickerClass()\"\n >\n <hlm-month-year-input\n [inputId]=\"effectiveId()\"\n [name]=\"cnm || name()\"\n [readonly]=\"readonly()\"\n [ariaLabel]=\"lbl\"\n [ariaDescribedby]=\"describedBy()\"\n [placeholder]=\"placeholder()\"\n [parseDate]=\"parseDate()\"\n [formatInputDate]=\"formatInputDate()\"\n [inputClass]=\"$inputClass()\"\n />\n </hlm-month-year-picker>\n\n @if (showError()) {\n <hlm-error [id]=\"errorId()\" [class]=\"$errorClass()\">\n {{ resolvedError() }}\n </hlm-error>\n }\n\n @if (hnt) {\n <hlm-hint [id]=\"hintId()\" [class]=\"$hintClass()\">\n {{ hnt }}\n </hlm-hint>\n }\n </hlm-form-field>\n ",
142
+ }]
143
+ }], 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 }] }], 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 }] }], min: [{ type: i0.Input, args: [{ isSignal: true, alias: "min", required: false }] }], max: [{ type: i0.Input, args: [{ isSignal: true, alias: "max", required: false }] }], autoCloseOnSelect: [{ type: i0.Input, args: [{ isSignal: true, alias: "autoCloseOnSelect", required: false }] }], formatDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "formatDate", required: false }] }], transformDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "transformDate", required: false }] }], parseDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "parseDate", required: false }] }], formatInputDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "formatInputDate", required: false }] }], userClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], labelClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "labelClass", required: false }] }], pickerClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "pickerClass", 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 }] }] } });
144
+
145
+ /*
146
+ * Public API Surface of form-month-year-picker
147
+ */
148
+
149
+ /**
150
+ * Generated bundle index. Do not edit.
151
+ */
152
+
153
+ export { EgFormMonthYearPicker };
154
+
@@ -0,0 +1,24 @@
1
+ {
2
+ "name": "form-month-year-picker",
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-month-year-picker.mjs",
13
+ "typings": "types/form-month-year-picker.d.ts",
14
+ "exports": {
15
+ "./package.json": {
16
+ "default": "./package.json"
17
+ },
18
+ ".": {
19
+ "types": "./types/form-month-year-picker.d.ts",
20
+ "default": "./fesm2022/form-month-year-picker.mjs"
21
+ }
22
+ },
23
+ "type": "module"
24
+ }
@@ -0,0 +1,73 @@
1
+ import * as _angular_core from '@angular/core';
2
+ import { ClassValue } from 'clsx';
3
+
4
+ declare class EgFormMonthYearPicker {
5
+ private readonly formGroupDirective;
6
+ private readonly _errorMessages;
7
+ private readonly generatedId;
8
+ private readonly _config;
9
+ label: _angular_core.InputSignal<string | undefined>;
10
+ controlId: _angular_core.InputSignal<string | undefined>;
11
+ controlName: _angular_core.InputSignal<string>;
12
+ error: _angular_core.InputSignal<string | undefined>;
13
+ /**
14
+ * Auto-resolve the displayed message from the control's `ValidationErrors`
15
+ * when `error()` is unset. Explicit `error()` always wins. Set to `false`
16
+ * for manual-only messages.
17
+ */
18
+ autoError: _angular_core.InputSignal<boolean>;
19
+ hint: _angular_core.InputSignal<string | undefined>;
20
+ id: _angular_core.InputSignal<string | undefined>;
21
+ name: _angular_core.InputSignal<string | undefined>;
22
+ placeholder: _angular_core.InputSignal<string>;
23
+ readonly: _angular_core.InputSignal<boolean>;
24
+ disabled: _angular_core.InputSignal<boolean>;
25
+ required: _angular_core.InputSignal<boolean>;
26
+ min: _angular_core.InputSignal<string | Date | null>;
27
+ max: _angular_core.InputSignal<string | Date | null>;
28
+ autoCloseOnSelect: _angular_core.InputSignal<boolean>;
29
+ formatDate: _angular_core.InputSignal<(date: Date) => string>;
30
+ transformDate: _angular_core.InputSignal<(date: Date) => Date>;
31
+ parseDate: _angular_core.InputSignal<(value: string) => Date | null>;
32
+ formatInputDate: _angular_core.InputSignal<(date: Date) => string>;
33
+ readonly effectiveId: _angular_core.Signal<string>;
34
+ readonly errorId: _angular_core.Signal<string>;
35
+ readonly hintId: _angular_core.Signal<string>;
36
+ /**
37
+ * Displayed message: explicit `error()` wins; otherwise (when `autoError()`)
38
+ * auto-resolved from the control's `ValidationErrors`. Plain method (not a
39
+ * computed): `ValidationErrors` is not a signal, so the control must be read
40
+ * fresh on every change-detection pass.
41
+ */
42
+ protected resolvedError(): string | undefined;
43
+ /**
44
+ * Whether the error is surfaced: message present + control invalid +
45
+ * touched/dirty/submitted. Gates the visual `<hlm-error>` (and
46
+ * `describedBy()`, where present) so sighted and screen-reader output agree.
47
+ */
48
+ protected showError(): boolean;
49
+ /**
50
+ * Bounds projected onto the picker's `Date` model. The cast keeps the
51
+ * template's generic inference on `Date` while passing runtime values
52
+ * through untouched.
53
+ */
54
+ protected readonly $min: _angular_core.Signal<Date | undefined>;
55
+ protected readonly $max: _angular_core.Signal<Date | undefined>;
56
+ describedBy(): string | null;
57
+ userClass: _angular_core.InputSignal<ClassValue>;
58
+ labelClass: _angular_core.InputSignal<string>;
59
+ pickerClass: _angular_core.InputSignal<string>;
60
+ inputClass: _angular_core.InputSignal<string>;
61
+ errorClass: _angular_core.InputSignal<string>;
62
+ hintClass: _angular_core.InputSignal<string>;
63
+ $userClass: _angular_core.Signal<string>;
64
+ $labelClass: _angular_core.Signal<string>;
65
+ $pickerClass: _angular_core.Signal<string>;
66
+ $inputClass: _angular_core.Signal<string>;
67
+ $errorClass: _angular_core.Signal<string>;
68
+ $hintClass: _angular_core.Signal<string>;
69
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<EgFormMonthYearPicker, never>;
70
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<EgFormMonthYearPicker, "eg-form-month-year-picker", 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; }; "readonly": { "alias": "readonly"; "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; }; "autoCloseOnSelect": { "alias": "autoCloseOnSelect"; "required": false; "isSignal": true; }; "formatDate": { "alias": "formatDate"; "required": false; "isSignal": true; }; "transformDate": { "alias": "transformDate"; "required": false; "isSignal": true; }; "parseDate": { "alias": "parseDate"; "required": false; "isSignal": true; }; "formatInputDate": { "alias": "formatInputDate"; "required": false; "isSignal": true; }; "userClass": { "alias": "class"; "required": false; "isSignal": true; }; "labelClass": { "alias": "labelClass"; "required": false; "isSignal": true; }; "pickerClass": { "alias": "pickerClass"; "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>;
71
+ }
72
+
73
+ export { EgFormMonthYearPicker };
@@ -0,0 +1,206 @@
1
+ # Form Native Select (`@egose/shadcn-theme-ng/form-native-select`)
2
+
3
+ A ready-made reactive-form select field using the platform `<select>`: label + `hlm-native-select` + validation error/hint display in one tag. Prefer `eg-form-select` for the popover experience; use this where a native control is required (mobile, no-JS fallbacks, minimal bundles).
4
+
5
+ The Angular implementation is a standalone wrapper: it renders `HlmFormField` / `HlmError` / `HlmHint` from `@egose/shadcn-theme-ng/form-field`, `HlmLabel`, and `HlmNativeSelect` from `@egose/shadcn-theme-ng/native-select`. The inner select 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-native-select` and `@egose/shadcn-theme-ng-tw/form-native-select`
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`, `@ng-icons/*`, `rxjs`, …) are documented in the
23
+ [package README](../../README.md#peer-dependencies). This subpath additionally relies at runtime on
24
+ `@egose/shadcn-theme-ng/native-select`, `@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-native-select/src/public-api.ts`):
30
+
31
+ ```ts
32
+ import { EgFormNativeSelect, provideEgFormNativeSelectConfig } from '@egose/shadcn-theme-ng/form-native-select';
33
+ // tw variant: replace with '@egose/shadcn-theme-ng-tw/form-native-select'
34
+ ```
35
+
36
+ Standalone usage:
37
+
38
+ ```ts
39
+ import { Component } from '@angular/core';
40
+ import { ReactiveFormsModule } from '@angular/forms';
41
+ import { EgFormNativeSelect } from '@egose/shadcn-theme-ng/form-native-select';
42
+
43
+ @Component({
44
+ selector: 'app-demo',
45
+ standalone: true,
46
+ imports: [ReactiveFormsModule, EgFormNativeSelect],
47
+ template: `...`,
48
+ })
49
+ export class DemoComponent {}
50
+ ```
51
+
52
+ NgModule-based consumer: add `EgFormNativeSelect` (and `ReactiveFormsModule`) to the module's
53
+ `imports` — it is a standalone component, not a module.
54
+
55
+ `ControlValueAccessor` behavior: `eg-form-native-select` itself is not a `ControlValueAccessor`; the
56
+ inner `hlm-native-select` 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-native-select
64
+ controlName="country"
65
+ label="Country"
66
+ [options]="countries"
67
+ [required]="true"
68
+ error="Country is required."
69
+ />
70
+ </form>
71
+ ```
72
+
73
+ Selector (from source): `eg-form-native-select` (standalone component, host `tw:w-full`).
74
+
75
+ ## API reference
76
+
77
+ ### `EgFormNativeSelect` — `eg-form-native-select`
78
+
79
+ | Input | Type | Default | Description |
80
+ | ------------- | ------------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
81
+ | `controlName` | `string` | `''` | `formControlName` key inside the parent `FormGroup`. **Required.** |
82
+ | `label` | `string \| undefined` | — | Label text (hidden when omitted). |
83
+ | `error` | `string \| undefined` | — | Error text shown when invalid. |
84
+ | `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`. |
85
+ | `hint` | `string \| undefined` | — | Hint text shown otherwise. |
86
+ | `controlId` | `string \| undefined` | — | Explicit id (first priority for `effectiveId`). |
87
+ | `id` | `string \| undefined` | — | Fallback id (second priority). |
88
+ | `name` | `string \| undefined` | — | Native `name` forwarded to the inner `<select>` (`controlName` wins). |
89
+ | `disabled` | `boolean` | `false` | Locks interaction (form control stays enabled). |
90
+ | `required` | `boolean` | `false` | Shows a red `*` next to the label. |
91
+ | `options` | `{ value, label, disabled? }[]` | `[]` | Rendered as native `<option>` elements. |
92
+ | `class` | `ClassValue` | `''` | Extra host classes (base `tw:w-full`). |
93
+ | `labelClass` | `string` | `''` | Extra label classes (base `tw:mb-1 tw:gap-0`). |
94
+ | `selectClass` | `string` | `''` | Extra inner-select classes, merged into `HlmNativeSelect.selectClass`. |
95
+ | `errorClass` | `string` | `''` | Extra error classes (base `tw:mt-0`). |
96
+ | `hintClass` | `string` | `''` | Extra hint classes (base `tw:mt-0`). |
97
+
98
+ | Member | Description |
99
+ | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ |
100
+ | `effectiveId` | `controlId() \|\| id() \|\| generated` — wired to select `selectId` and label `for`. |
101
+ | `errorId` / `hintId` | `effectiveId + '-error' / '-hint'`. |
102
+ | `describedBy()` | `errorId` when `error()` is set and control is invalid + dirty/touched, else `hintId` when `hint()` is set, else `null` — wired to select `ariaDescribedby`. |
103
+
104
+ Requires a `[formGroup]` ancestor (injects `FormGroupDirective`, provides `ControlContainer → FormGroupDirective`).
105
+
106
+ ## Examples
107
+
108
+ ### 1. Basic required select
109
+
110
+ ```ts
111
+ import { Component, inject } from '@angular/core';
112
+ import { FormBuilder, ReactiveFormsModule, Validators } from '@angular/forms';
113
+ import { EgFormNativeSelect } from '@egose/shadcn-theme-ng/form-native-select';
114
+
115
+ @Component({
116
+ selector: 'app-country',
117
+ standalone: true,
118
+ imports: [ReactiveFormsModule, EgFormNativeSelect],
119
+ template: `
120
+ <form [formGroup]="form" (ngSubmit)="submit()">
121
+ <eg-form-native-select
122
+ controlName="country"
123
+ label="Country"
124
+ [options]="countries"
125
+ [required]="true"
126
+ error="Country is required."
127
+ />
128
+ <button type="submit" [disabled]="form.invalid">Continue</button>
129
+ </form>
130
+ `,
131
+ })
132
+ export class CountryComponent {
133
+ private readonly fb = inject(FormBuilder);
134
+ readonly form = this.fb.group({ country: ['', Validators.required] });
135
+ readonly countries = [
136
+ { value: '', label: 'Select…' },
137
+ { value: 'de', label: 'Germany' },
138
+ { value: 'fr', label: 'France' },
139
+ ];
140
+ submit() {
141
+ console.log(this.form.value.country);
142
+ }
143
+ }
144
+ ```
145
+
146
+ ### 2. Hint + custom styling
147
+
148
+ ```ts
149
+ import { Component, inject } from '@angular/core';
150
+ import { FormBuilder, ReactiveFormsModule } from '@angular/forms';
151
+ import { EgFormNativeSelect } from '@egose/shadcn-theme-ng/form-native-select';
152
+
153
+ @Component({
154
+ selector: 'app-locale',
155
+ standalone: true,
156
+ imports: [ReactiveFormsModule, EgFormNativeSelect],
157
+ template: `
158
+ <form [formGroup]="form">
159
+ <eg-form-native-select
160
+ controlName="locale"
161
+ label="Language"
162
+ [options]="locales"
163
+ selectClass="tw:text-lg"
164
+ hint="Used for emails and invoices."
165
+ />
166
+ </form>
167
+ `,
168
+ })
169
+ export class LocaleComponent {
170
+ private readonly fb = inject(FormBuilder);
171
+ readonly form = this.fb.group({ locale: ['en'] });
172
+ readonly locales = [
173
+ { value: 'en', label: 'English' },
174
+ { value: 'de', label: 'Deutsch' },
175
+ ];
176
+ }
177
+ ```
178
+
179
+ ## Accessibility notes
180
+
181
+ - Label `for` ↔ select `selectId` wiring is automatic via `effectiveId`; the select also receives `name` and `ariaDescribedby` (error/hint id) — always pass a `label`.
182
+ - The required `*` is visual; pair with `Validators.required` so assistive tech and validation agree.
183
+ - Native `<select>` brings platform keyboard/screen-reader behavior for free.
184
+
185
+ ## Theming / CSS variables
186
+
187
+ No component-specific CSS variables. Style per-instance via `class` / `labelClass` / `selectClass` / `errorClass` / `hintClass` (precedence: library base < global config < per-instance).
188
+
189
+ Global defaults per styling slot via the wrapper config:
190
+
191
+ ```ts
192
+ import { provideEgFormNativeSelectConfig } from '@egose/shadcn-theme-ng/form-native-select';
193
+
194
+ await bootstrapApplication(App, {
195
+ providers: [provideEgFormNativeSelectConfig({ selectClass: 'tw:text-sm', labelClass: 'tw:font-medium' })],
196
+ });
197
+ ```
198
+
199
+ The host keeps `tw:w-full`; constrain width with `class` (e.g. `tw:max-w-xs`) or a wrapping container.
200
+
201
+ ## Related subpaths
202
+
203
+ - `@egose/shadcn-theme-ng/native-select` — raw `hlm-native-select` for custom layouts.
204
+ - `@egose/shadcn-theme-ng/form-select` — the popover-based counterpart (`eg-form-select`).
205
+ - `@egose/shadcn-theme-ng/form-field` — `hlm-form-field` / `hlm-error` / `hlm-hint` used internally.
206
+ - `@egose/shadcn-theme-ng/form-field-simple` — alternative minimal wrapper when you compose controls by hand.
@@ -0,0 +1,132 @@
1
+ import * as i0 from '@angular/core';
2
+ import { InjectionToken, inject, input, computed, Component } from '@angular/core';
3
+ import * as i1 from '@angular/forms';
4
+ import { FormGroupDirective, ReactiveFormsModule, ControlContainer } from '@angular/forms';
5
+ import { injectEgFormErrorMessages, HlmFormIdGenerator, resolveEgFormError, HlmFormField, HlmError, HlmHint } from '@egose/shadcn-theme-ng/form-field';
6
+ import { HlmLabel } from '@egose/shadcn-theme-ng/label';
7
+ import { HlmNativeSelect } from '@egose/shadcn-theme-ng/native-select';
8
+ import { hlm } from '@egose/shadcn-theme-ng/utils';
9
+
10
+ const EgFormNativeSelectConfigToken = new InjectionToken('EgFormNativeSelectConfig');
11
+ function provideEgFormNativeSelectConfig(config) {
12
+ return { provide: EgFormNativeSelectConfigToken, useValue: { ...config } };
13
+ }
14
+ function injectEgFormNativeSelectConfig() {
15
+ return inject(EgFormNativeSelectConfigToken, { optional: true }) ?? {};
16
+ }
17
+
18
+ class EgFormNativeSelect {
19
+ formGroupDirective = inject(FormGroupDirective);
20
+ _errorMessages = injectEgFormErrorMessages();
21
+ generatedId = inject(HlmFormIdGenerator).generate('eg-form-native-select');
22
+ _config = injectEgFormNativeSelectConfig();
23
+ label = input(undefined, /* @ts-ignore */
24
+ ...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
25
+ controlId = input(undefined, /* @ts-ignore */
26
+ ...(ngDevMode ? [{ debugName: "controlId" }] : /* istanbul ignore next */ []));
27
+ controlName = input('', /* @ts-ignore */
28
+ ...(ngDevMode ? [{ debugName: "controlName" }] : /* istanbul ignore next */ []));
29
+ error = input(undefined, /* @ts-ignore */
30
+ ...(ngDevMode ? [{ debugName: "error" }] : /* istanbul ignore next */ []));
31
+ /**
32
+ * Auto-resolve the displayed message from the control's `ValidationErrors`
33
+ * when `error()` is unset. Explicit `error()` always wins. Set to `false`
34
+ * for manual-only messages.
35
+ */
36
+ autoError = input(true, /* @ts-ignore */
37
+ ...(ngDevMode ? [{ debugName: "autoError" }] : /* istanbul ignore next */ []));
38
+ hint = input(undefined, /* @ts-ignore */
39
+ ...(ngDevMode ? [{ debugName: "hint" }] : /* istanbul ignore next */ []));
40
+ id = input(undefined, /* @ts-ignore */
41
+ ...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
42
+ name = input(undefined, /* @ts-ignore */
43
+ ...(ngDevMode ? [{ debugName: "name" }] : /* istanbul ignore next */ []));
44
+ disabled = input(false, /* @ts-ignore */
45
+ ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
46
+ required = input(false, /* @ts-ignore */
47
+ ...(ngDevMode ? [{ debugName: "required" }] : /* istanbul ignore next */ []));
48
+ options = input([], /* @ts-ignore */
49
+ ...(ngDevMode ? [{ debugName: "options" }] : /* istanbul ignore next */ []));
50
+ effectiveId = computed(() => this.controlId() || this.id() || this.generatedId, /* @ts-ignore */
51
+ ...(ngDevMode ? [{ debugName: "effectiveId" }] : /* istanbul ignore next */ []));
52
+ errorId = computed(() => `${this.effectiveId()}-error`, /* @ts-ignore */
53
+ ...(ngDevMode ? [{ debugName: "errorId" }] : /* istanbul ignore next */ []));
54
+ hintId = computed(() => `${this.effectiveId()}-hint`, /* @ts-ignore */
55
+ ...(ngDevMode ? [{ debugName: "hintId" }] : /* istanbul ignore next */ []));
56
+ /**
57
+ * Displayed message: explicit `error()` wins; otherwise (when `autoError()`)
58
+ * auto-resolved from the control's `ValidationErrors`. Plain method (not a
59
+ * computed): `ValidationErrors` is not a signal, so the control must be read
60
+ * fresh on every change-detection pass.
61
+ */
62
+ resolvedError() {
63
+ const explicit = this.error();
64
+ if (explicit)
65
+ return explicit;
66
+ if (!this.autoError())
67
+ return undefined;
68
+ const control = this.formGroupDirective.form.get(this.controlName());
69
+ return resolveEgFormError(control?.errors ?? null, this.label(), this._errorMessages);
70
+ }
71
+ /**
72
+ * Whether the error is surfaced: message present + control invalid +
73
+ * touched/dirty/submitted. Gates the visual `<hlm-error>` (and
74
+ * `describedBy()`, where present) so sighted and screen-reader output agree.
75
+ */
76
+ showError() {
77
+ const control = this.formGroupDirective.form.get(this.controlName());
78
+ return (!!this.resolvedError() &&
79
+ !!control?.invalid &&
80
+ (control.dirty || control.touched || this.formGroupDirective.submitted));
81
+ }
82
+ describedBy() {
83
+ return this.showError() ? this.errorId() : this.hint() ? this.hintId() : null;
84
+ }
85
+ // Styling
86
+ userClass = input('', { ...(ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {}), alias: 'class' });
87
+ labelClass = input('', /* @ts-ignore */
88
+ ...(ngDevMode ? [{ debugName: "labelClass" }] : /* istanbul ignore next */ []));
89
+ selectClass = input('', /* @ts-ignore */
90
+ ...(ngDevMode ? [{ debugName: "selectClass" }] : /* istanbul ignore next */ []));
91
+ errorClass = input('', /* @ts-ignore */
92
+ ...(ngDevMode ? [{ debugName: "errorClass" }] : /* istanbul ignore next */ []));
93
+ hintClass = input('', /* @ts-ignore */
94
+ ...(ngDevMode ? [{ debugName: "hintClass" }] : /* istanbul ignore next */ []));
95
+ // Computed classes (library base < global config < per-instance)
96
+ $userClass = computed(() => hlm("w-full", this.userClass()), /* @ts-ignore */
97
+ ...(ngDevMode ? [{ debugName: "$userClass" }] : /* istanbul ignore next */ []));
98
+ $labelClass = computed(() => hlm("mb-1 gap-0", this._config.labelClass, this.labelClass()), /* @ts-ignore */
99
+ ...(ngDevMode ? [{ debugName: "$labelClass" }] : /* istanbul ignore next */ []));
100
+ $selectClass = computed(() => hlm("w-full", this._config.selectClass, this.selectClass()), /* @ts-ignore */
101
+ ...(ngDevMode ? [{ debugName: "$selectClass" }] : /* istanbul ignore next */ []));
102
+ $errorClass = computed(() => hlm("mt-0", this._config.errorClass, this.errorClass()), /* @ts-ignore */
103
+ ...(ngDevMode ? [{ debugName: "$errorClass" }] : /* istanbul ignore next */ []));
104
+ $hintClass = computed(() => hlm("mt-0", this._config.hintClass, this.hintClass()), /* @ts-ignore */
105
+ ...(ngDevMode ? [{ debugName: "$hintClass" }] : /* istanbul ignore next */ []));
106
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: EgFormNativeSelect, deps: [], target: i0.ɵɵFactoryTarget.Component });
107
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.3", type: EgFormNativeSelect, isStandalone: true, selector: "eg-form-native-select", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, controlId: { classPropertyName: "controlId", publicName: "controlId", isSignal: true, isRequired: false, transformFunction: null }, controlName: { classPropertyName: "controlName", publicName: "controlName", isSignal: true, isRequired: false, transformFunction: null }, error: { classPropertyName: "error", publicName: "error", isSignal: true, isRequired: false, transformFunction: null }, autoError: { classPropertyName: "autoError", publicName: "autoError", isSignal: true, isRequired: false, transformFunction: null }, hint: { classPropertyName: "hint", publicName: "hint", isSignal: true, isRequired: false, transformFunction: null }, id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null }, userClass: { classPropertyName: "userClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, labelClass: { classPropertyName: "labelClass", publicName: "labelClass", isSignal: true, isRequired: false, transformFunction: null }, selectClass: { classPropertyName: "selectClass", publicName: "selectClass", isSignal: true, isRequired: false, transformFunction: null }, errorClass: { classPropertyName: "errorClass", publicName: "errorClass", isSignal: true, isRequired: false, transformFunction: null }, hintClass: { classPropertyName: "hintClass", publicName: "hintClass", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "$userClass()" } }, providers: [{ provide: ControlContainer, useExisting: FormGroupDirective }], ngImport: i0, template: "\n @let lbl = label();\n @let cnm = controlName();\n @let hnt = hint();\n @let rqrd = required();\n\n <hlm-form-field>\n @if (lbl) {\n <label hlmLabel [for]=\"effectiveId()\" [class]=\"$labelClass()\"\n >{{ lbl }}\n @if (rqrd) {\n <span class=\"text-red-500\">*</span>\n }\n </label>\n }\n\n <hlm-native-select\n [selectId]=\"effectiveId()\"\n [name]=\"cnm || name()\"\n [ariaDescribedby]=\"describedBy()\"\n [disabled]=\"disabled()\"\n [formControlName]=\"cnm\"\n [selectClass]=\"$selectClass()\"\n >\n @for (option of options(); track option.value) {\n <option\n class=\"bg-[Canvas] text-[CanvasText]\"\n [value]=\"option.value\"\n [disabled]=\"option.disabled ?? false\"\n >\n {{ option.label }}\n </option>\n }\n </hlm-native-select>\n\n @if (showError()) {\n <hlm-error [id]=\"errorId()\" [class]=\"$errorClass()\">\n {{ resolvedError() }}\n </hlm-error>\n }\n\n @if (hnt) {\n <hlm-hint [id]=\"hintId()\" [class]=\"$hintClass()\">\n {{ hnt }}\n </hlm-hint>\n }\n </hlm-form-field>\n ", isInline: true, dependencies: [{ kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i1.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { 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: HlmNativeSelect, selector: "hlm-native-select", inputs: ["selectId", "name", "ariaDescribedby", "selectClass", "selectIconClass", "size", "disabled", "forceInvalid", "aria-invalid", "value"], outputs: ["valueChange"] }] });
108
+ }
109
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: EgFormNativeSelect, decorators: [{
110
+ type: Component,
111
+ args: [{
112
+ selector: 'eg-form-native-select',
113
+ standalone: true,
114
+ host: {
115
+ '[class]': '$userClass()',
116
+ },
117
+ imports: [ReactiveFormsModule, HlmFormField, HlmError, HlmHint, HlmLabel, HlmNativeSelect],
118
+ providers: [{ provide: ControlContainer, useExisting: FormGroupDirective }],
119
+ template: "\n @let lbl = label();\n @let cnm = controlName();\n @let hnt = hint();\n @let rqrd = required();\n\n <hlm-form-field>\n @if (lbl) {\n <label hlmLabel [for]=\"effectiveId()\" [class]=\"$labelClass()\"\n >{{ lbl }}\n @if (rqrd) {\n <span class=\"text-red-500\">*</span>\n }\n </label>\n }\n\n <hlm-native-select\n [selectId]=\"effectiveId()\"\n [name]=\"cnm || name()\"\n [ariaDescribedby]=\"describedBy()\"\n [disabled]=\"disabled()\"\n [formControlName]=\"cnm\"\n [selectClass]=\"$selectClass()\"\n >\n @for (option of options(); track option.value) {\n <option\n class=\"bg-[Canvas] text-[CanvasText]\"\n [value]=\"option.value\"\n [disabled]=\"option.disabled ?? false\"\n >\n {{ option.label }}\n </option>\n }\n </hlm-native-select>\n\n @if (showError()) {\n <hlm-error [id]=\"errorId()\" [class]=\"$errorClass()\">\n {{ resolvedError() }}\n </hlm-error>\n }\n\n @if (hnt) {\n <hlm-hint [id]=\"hintId()\" [class]=\"$hintClass()\">\n {{ hnt }}\n </hlm-hint>\n }\n </hlm-form-field>\n ",
120
+ }]
121
+ }], propDecorators: { label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], controlId: [{ type: i0.Input, args: [{ isSignal: true, alias: "controlId", required: false }] }], controlName: [{ type: i0.Input, args: [{ isSignal: true, alias: "controlName", required: false }] }], error: [{ type: i0.Input, args: [{ isSignal: true, alias: "error", required: false }] }], autoError: [{ type: i0.Input, args: [{ isSignal: true, alias: "autoError", required: false }] }], hint: [{ type: i0.Input, args: [{ isSignal: true, alias: "hint", required: false }] }], id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], name: [{ type: i0.Input, args: [{ isSignal: true, alias: "name", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }], options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }], userClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], labelClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "labelClass", required: false }] }], selectClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectClass", required: false }] }], errorClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "errorClass", required: false }] }], hintClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "hintClass", required: false }] }] } });
122
+
123
+ /*
124
+ * Public API Surface of form-native-select
125
+ */
126
+
127
+ /**
128
+ * Generated bundle index. Do not edit.
129
+ */
130
+
131
+ export { EgFormNativeSelect, injectEgFormNativeSelectConfig, provideEgFormNativeSelectConfig };
132
+