@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
@@ -1,14 +1,23 @@
1
1
  import * as _angular_core from '@angular/core';
2
+ import { ValueProvider } from '@angular/core';
2
3
  import { ClassValue } from 'clsx';
3
4
  import { SelectOption } from '@egose/shadcn-theme-ng-tw/searchable-multiselect';
4
5
 
5
6
  declare class EgFormSearchableMultiselect {
6
7
  private readonly formGroupDirective;
8
+ private readonly _errorMessages;
7
9
  private readonly generatedId;
10
+ private readonly _config;
8
11
  label: _angular_core.InputSignal<string | undefined>;
9
12
  controlId: _angular_core.InputSignal<string | undefined>;
10
13
  controlName: _angular_core.InputSignal<string>;
11
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>;
12
21
  hint: _angular_core.InputSignal<string | undefined>;
13
22
  id: _angular_core.InputSignal<string | undefined>;
14
23
  placeholder: _angular_core.InputSignal<string>;
@@ -17,6 +26,19 @@ declare class EgFormSearchableMultiselect {
17
26
  readonly effectiveId: _angular_core.Signal<string>;
18
27
  readonly errorId: _angular_core.Signal<string>;
19
28
  readonly hintId: _angular_core.Signal<string>;
29
+ /**
30
+ * Displayed message: explicit `error()` wins; otherwise (when `autoError()`)
31
+ * auto-resolved from the control's `ValidationErrors`. Plain method (not a
32
+ * computed): `ValidationErrors` is not a signal, so the control must be read
33
+ * fresh on every change-detection pass.
34
+ */
35
+ protected resolvedError(): string | undefined;
36
+ /**
37
+ * Whether the error is surfaced: message present + control invalid +
38
+ * touched/dirty/submitted. Gates the visual `<hlm-error>` (and
39
+ * `describedBy()`, where present) so sighted and screen-reader output agree.
40
+ */
41
+ protected showError(): boolean;
20
42
  describedBy(): string | null;
21
43
  options: _angular_core.InputSignal<SelectOption[]>;
22
44
  userClass: _angular_core.InputSignal<ClassValue>;
@@ -30,7 +52,22 @@ declare class EgFormSearchableMultiselect {
30
52
  $errorClass: _angular_core.Signal<string>;
31
53
  $hintClass: _angular_core.Signal<string>;
32
54
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<EgFormSearchableMultiselect, never>;
33
- static ɵcmp: _angular_core.ɵɵComponentDeclaration<EgFormSearchableMultiselect, "eg-form-searchable-multiselect", never, { "label": { "alias": "label"; "required": false; "isSignal": true; }; "controlId": { "alias": "controlId"; "required": false; "isSignal": true; }; "controlName": { "alias": "controlName"; "required": false; "isSignal": true; }; "error": { "alias": "error"; "required": false; "isSignal": true; }; "hint": { "alias": "hint"; "required": false; "isSignal": true; }; "id": { "alias": "id"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "required": { "alias": "required"; "required": false; "isSignal": true; }; "options": { "alias": "options"; "required": false; "isSignal": true; }; "userClass": { "alias": "class"; "required": false; "isSignal": true; }; "labelClass": { "alias": "labelClass"; "required": false; "isSignal": true; }; "controlClass": { "alias": "controlClass"; "required": false; "isSignal": true; }; "errorClass": { "alias": "errorClass"; "required": false; "isSignal": true; }; "hintClass": { "alias": "hintClass"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
55
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<EgFormSearchableMultiselect, "eg-form-searchable-multiselect", 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; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "required": { "alias": "required"; "required": false; "isSignal": true; }; "options": { "alias": "options"; "required": false; "isSignal": true; }; "userClass": { "alias": "class"; "required": false; "isSignal": true; }; "labelClass": { "alias": "labelClass"; "required": false; "isSignal": true; }; "controlClass": { "alias": "controlClass"; "required": false; "isSignal": true; }; "errorClass": { "alias": "errorClass"; "required": false; "isSignal": true; }; "hintClass": { "alias": "hintClass"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
34
56
  }
35
57
 
36
- export { EgFormSearchableMultiselect };
58
+ interface EgFormSearchableMultiselectConfig {
59
+ /**
60
+ * Global class defaults for `eg-form-searchable-multiselect` styling slots.
61
+ * Each is merged under the matching per-instance `*Class` input
62
+ * (library base < global config < per-instance).
63
+ */
64
+ labelClass?: string;
65
+ controlClass?: string;
66
+ errorClass?: string;
67
+ hintClass?: string;
68
+ }
69
+ declare function provideEgFormSearchableMultiselectConfig(config: Partial<EgFormSearchableMultiselectConfig>): ValueProvider;
70
+ declare function injectEgFormSearchableMultiselectConfig(): EgFormSearchableMultiselectConfig;
71
+
72
+ export { EgFormSearchableMultiselect, injectEgFormSearchableMultiselectConfig, provideEgFormSearchableMultiselectConfig };
73
+ export type { EgFormSearchableMultiselectConfig };
@@ -75,25 +75,26 @@ In multi mode the inner `brn-select` becomes `brn-select-multiple`; everything e
75
75
 
76
76
  ### `eg-form-select` — `EgFormSelect`
77
77
 
78
- | Input | Type | Default | Description |
79
- | --------------------- | --------------------- | ----------- | --------------------------------------------------------------------------------------------------------- |
80
- | `label` | `string \| undefined` | `undefined` | Field label rendered as `<label hlmLabel>` bound to the trigger button id. |
81
- | `controlName` | `string` | `''` | **Required.** Control name in the parent `FormGroup`; forwarded as `formControlName`. |
82
- | `controlId` | `string \| undefined` | `undefined` | Explicit id; falls back to `id`, then generated `eg-form-select-…`. |
83
- | `id` | `string \| undefined` | `undefined` | Alias for an explicit id (same fallback chain). Forwarded as `buttonId` to the select trigger. |
84
- | `error` | `string \| undefined` | `undefined` | Error text rendered in `<hlm-error>`. |
85
- | `hint` | `string \| undefined` | `undefined` | Hint text rendered in `<hlm-hint>`. |
86
- | `placeholder` | `string` | `''` | Placeholder forwarded to `<hlm-select-value>`. |
87
- | `disabled` | `boolean` | `false` | Forwarded as `wrapperDisabled` to `<hlm-select-trigger>`. |
88
- | `required` | `boolean` | `false` | Renders a red `*` next to the label (pair with `Validators.required`). |
89
- | `multiple` | `boolean` | `false` | When `true`, renders `brn-select-multiple` (value is `string[]`). |
90
- | `options` | `SelectOption[]` | `[]` | `{ value: string; label: string }[]` rendered as `<hlm-select-item>` rows. Local interface, not exported. |
91
- | `optionsLabel` | `string \| undefined` | `undefined` | Optional group heading rendered once as `<hlm-select-label>`. |
92
- | `class` (`userClass`) | `ClassValue` | `''` | Extra host classes (merged over `tw:flex tw:flex-col`). |
93
- | `labelClass` | `string` | `''` | Extra label classes (merged over `tw:mb-1 tw:gap-0`). |
94
- | `selectClass` | `string` | `''` | Extra trigger classes (merged over `tw:w-full`). |
95
- | `errorClass` | `string` | `''` | Extra error classes (merged over `tw:mt-0`). |
96
- | `hintClass` | `string` | `''` | Extra hint classes (merged over `tw:mt-0`). |
78
+ | Input | Type | Default | Description |
79
+ | --------------------- | --------------------- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
80
+ | `label` | `string \| undefined` | `undefined` | Field label rendered as `<label hlmLabel>` bound to the trigger button id. |
81
+ | `controlName` | `string` | `''` | **Required.** Control name in the parent `FormGroup`; forwarded as `formControlName`. |
82
+ | `controlId` | `string \| undefined` | `undefined` | Explicit id; falls back to `id`, then generated `eg-form-select-…`. |
83
+ | `id` | `string \| undefined` | `undefined` | Alias for an explicit id (same fallback chain). Forwarded as `buttonId` to the select trigger. |
84
+ | `error` | `string \| undefined` | `undefined` | Error text rendered in `<hlm-error>`. |
85
+ | `autoError` | `boolean` | `true` | Auto-resolve the message from the control's `ValidationErrors` when `error` is unset. Explicit `error` always wins; `error=""` counts as unset. Global wording via `provideEgFormErrorMessages`. |
86
+ | `hint` | `string \| undefined` | `undefined` | Hint text rendered in `<hlm-hint>`. |
87
+ | `placeholder` | `string` | `''` | Placeholder forwarded to `<hlm-select-value>`. |
88
+ | `disabled` | `boolean` | `false` | Forwarded as `wrapperDisabled` to `<hlm-select-trigger>`. |
89
+ | `required` | `boolean` | `false` | Renders a red `*` next to the label (pair with `Validators.required`). |
90
+ | `multiple` | `boolean` | `false` | When `true`, renders `brn-select-multiple` (value is `string[]`). |
91
+ | `options` | `SelectOption[]` | `[]` | `{ value: string; label: string }[]` rendered as `<hlm-select-item>` rows. Local interface, not exported. |
92
+ | `optionsLabel` | `string \| undefined` | `undefined` | Optional group heading rendered once as `<hlm-select-label>`. |
93
+ | `class` (`userClass`) | `ClassValue` | `''` | Extra host classes (merged over `tw:flex tw:flex-col`). |
94
+ | `labelClass` | `string` | `''` | Extra label classes (merged over `tw:mb-1 tw:gap-0`). |
95
+ | `selectClass` | `string` | `''` | Extra trigger classes (merged over `tw:w-full`). |
96
+ | `errorClass` | `string` | `''` | Extra error classes (merged over `tw:mt-0`). |
97
+ | `hintClass` | `string` | `''` | Extra hint classes (merged over `tw:mt-0`). |
97
98
 
98
99
  No outputs. Readonly computeds/methods: `effectiveId()`, `errorId()`, `hintId()`, `describedBy(): string | null` (error id when invalid + dirty/touched, else hint id, else `null`).
99
100
 
@@ -343,6 +344,16 @@ export class ProgrammaticExample {
343
344
 
344
345
  No component-specific CSS variables; visuals come from the shared theme tokens via the `HlmSelect*` parts. Use `selectClass` / `labelClass` / `errorClass` / `hintClass` / `class` to adjust sizing and spacing.
345
346
 
347
+ Global defaults per styling slot via the wrapper config (precedence: library base < global config < per-instance):
348
+
349
+ ```ts
350
+ import { provideEgFormSelectConfig } from '@egose/shadcn-theme-ng/form-select';
351
+
352
+ await bootstrapApplication(App, {
353
+ providers: [provideEgFormSelectConfig({ selectClass: 'tw:text-sm', labelClass: 'tw:font-medium' })],
354
+ });
355
+ ```
356
+
346
357
  ## Related subpaths
347
358
 
348
359
  - `@egose/shadcn-theme-ng/select` — raw `HlmSelect`, `HlmSelectTrigger`, `HlmSelectValue`, `HlmSelectContent`, `HlmSelectItem`, `HlmSelectLabel` for custom layouts and grouped sections.
@@ -1,17 +1,27 @@
1
1
  import * as i0 from '@angular/core';
2
- import { inject, input, computed, Component } from '@angular/core';
2
+ import { InjectionToken, inject, input, computed, Component } from '@angular/core';
3
3
  import * as i1 from '@angular/forms';
4
4
  import { FormGroupDirective, ReactiveFormsModule, ControlContainer } from '@angular/forms';
5
- import { HlmFormIdGenerator, HlmFormField, HlmError, HlmHint } from '@egose/shadcn-theme-ng-tw/form-field';
5
+ import { injectEgFormErrorMessages, HlmFormIdGenerator, resolveEgFormError, HlmFormField, HlmError, HlmHint } from '@egose/shadcn-theme-ng-tw/form-field';
6
6
  import { HlmLabel } from '@egose/shadcn-theme-ng-tw/label';
7
7
  import { hlm } from '@egose/shadcn-theme-ng-tw/utils';
8
8
  import { BrnSelectImports } from '@spartan-ng/brain/select';
9
9
  import * as i2 from '@egose/shadcn-theme-ng-tw/select';
10
10
  import { HlmSelectImports, HlmSelect, HlmSelectTrigger, HlmSelectValue, HlmSelectContent, HlmSelectItem, HlmSelectLabel } from '@egose/shadcn-theme-ng-tw/select';
11
11
 
12
+ const EgFormSelectConfigToken = new InjectionToken('EgFormSelectConfig');
13
+ function provideEgFormSelectConfig(config) {
14
+ return { provide: EgFormSelectConfigToken, useValue: { ...config } };
15
+ }
16
+ function injectEgFormSelectConfig() {
17
+ return inject(EgFormSelectConfigToken, { optional: true }) ?? {};
18
+ }
19
+
12
20
  class EgFormSelect {
13
21
  formGroupDirective = inject(FormGroupDirective);
22
+ _errorMessages = injectEgFormErrorMessages();
14
23
  generatedId = inject(HlmFormIdGenerator).generate('eg-form-select');
24
+ _config = injectEgFormSelectConfig();
15
25
  label = input(undefined, /* @ts-ignore */
16
26
  ...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
17
27
  controlId = input(undefined, /* @ts-ignore */
@@ -20,6 +30,13 @@ class EgFormSelect {
20
30
  ...(ngDevMode ? [{ debugName: "controlName" }] : /* istanbul ignore next */ []));
21
31
  error = input(undefined, /* @ts-ignore */
22
32
  ...(ngDevMode ? [{ debugName: "error" }] : /* istanbul ignore next */ []));
33
+ /**
34
+ * Auto-resolve the displayed message from the control's `ValidationErrors`
35
+ * when `error()` is unset. Explicit `error()` always wins. Set to `false`
36
+ * for manual-only messages.
37
+ */
38
+ autoError = input(true, /* @ts-ignore */
39
+ ...(ngDevMode ? [{ debugName: "autoError" }] : /* istanbul ignore next */ []));
23
40
  hint = input(undefined, /* @ts-ignore */
24
41
  ...(ngDevMode ? [{ debugName: "hint" }] : /* istanbul ignore next */ []));
25
42
  // HTML/select attributes
@@ -37,13 +54,34 @@ class EgFormSelect {
37
54
  ...(ngDevMode ? [{ debugName: "errorId" }] : /* istanbul ignore next */ []));
38
55
  hintId = computed(() => `${this.effectiveId()}-hint`, /* @ts-ignore */
39
56
  ...(ngDevMode ? [{ debugName: "hintId" }] : /* istanbul ignore next */ []));
40
- describedBy() {
57
+ /**
58
+ * Displayed message: explicit `error()` wins; otherwise (when `autoError()`)
59
+ * auto-resolved from the control's `ValidationErrors`. Plain method (not a
60
+ * computed): `ValidationErrors` is not a signal, so the control must be read
61
+ * fresh on every change-detection pass.
62
+ */
63
+ resolvedError() {
64
+ const explicit = this.error();
65
+ if (explicit)
66
+ return explicit;
67
+ if (!this.autoError())
68
+ return undefined;
41
69
  const control = this.formGroupDirective.form.get(this.controlName());
42
- return this.error() && control?.invalid && (control.dirty || control.touched)
43
- ? this.errorId()
44
- : this.hint()
45
- ? this.hintId()
46
- : null;
70
+ return resolveEgFormError(control?.errors ?? null, this.label(), this._errorMessages);
71
+ }
72
+ /**
73
+ * Whether the error is surfaced: message present + control invalid +
74
+ * touched/dirty/submitted. Gates the visual `<hlm-error>` (and
75
+ * `describedBy()`, where present) so sighted and screen-reader output agree.
76
+ */
77
+ showError() {
78
+ const control = this.formGroupDirective.form.get(this.controlName());
79
+ return (!!this.resolvedError() &&
80
+ !!control?.invalid &&
81
+ (control.dirty || control.touched || this.formGroupDirective.submitted));
82
+ }
83
+ describedBy() {
84
+ return this.showError() ? this.errorId() : this.hint() ? this.hintId() : null;
47
85
  }
48
86
  // Select-specific
49
87
  multiple = input(false, /* @ts-ignore */
@@ -62,22 +100,21 @@ class EgFormSelect {
62
100
  ...(ngDevMode ? [{ debugName: "errorClass" }] : /* istanbul ignore next */ []));
63
101
  hintClass = input('', /* @ts-ignore */
64
102
  ...(ngDevMode ? [{ debugName: "hintClass" }] : /* istanbul ignore next */ []));
65
- // Computed classes
66
- $userClass = computed(() => hlm('tw:flex tw:flex-col', this.userClass()), /* @ts-ignore */
103
+ // Computed classes (library base < global config < per-instance)
104
+ $userClass = computed(() => hlm('tw:w-full', this.userClass()), /* @ts-ignore */
67
105
  ...(ngDevMode ? [{ debugName: "$userClass" }] : /* istanbul ignore next */ []));
68
- $labelClass = computed(() => hlm('tw:mb-1 tw:gap-0', this.labelClass()), /* @ts-ignore */
106
+ $labelClass = computed(() => hlm('tw:mb-1 tw:gap-0', this._config.labelClass, this.labelClass()), /* @ts-ignore */
69
107
  ...(ngDevMode ? [{ debugName: "$labelClass" }] : /* istanbul ignore next */ []));
70
- $selectClass = computed(() => hlm('tw:w-full', this.selectClass()), /* @ts-ignore */
108
+ $selectClass = computed(() => hlm('tw:w-full', this._config.selectClass, this.selectClass()), /* @ts-ignore */
71
109
  ...(ngDevMode ? [{ debugName: "$selectClass" }] : /* istanbul ignore next */ []));
72
- $errorClass = computed(() => hlm('tw:mt-0', this.errorClass()), /* @ts-ignore */
110
+ $errorClass = computed(() => hlm('tw:mt-0', this._config.errorClass, this.errorClass()), /* @ts-ignore */
73
111
  ...(ngDevMode ? [{ debugName: "$errorClass" }] : /* istanbul ignore next */ []));
74
- $hintClass = computed(() => hlm('tw:mt-0', this.hintClass()), /* @ts-ignore */
112
+ $hintClass = computed(() => hlm('tw:mt-0', this._config.hintClass, this.hintClass()), /* @ts-ignore */
75
113
  ...(ngDevMode ? [{ debugName: "$hintClass" }] : /* istanbul ignore next */ []));
76
114
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: EgFormSelect, deps: [], target: i0.ɵɵFactoryTarget.Component });
77
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.3", type: EgFormSelect, isStandalone: true, selector: "eg-form-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 }, hint: { classPropertyName: "hint", publicName: "hint", isSignal: true, isRequired: false, transformFunction: null }, id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", 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 }, multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null }, optionsLabel: { classPropertyName: "optionsLabel", publicName: "optionsLabel", 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: { classAttribute: "tw:w-full" }, providers: [{ provide: ControlContainer, useExisting: FormGroupDirective }], ngImport: i0, template: `
115
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.3", type: EgFormSelect, isStandalone: true, selector: "eg-form-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 }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", 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 }, multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null }, optionsLabel: { classPropertyName: "optionsLabel", publicName: "optionsLabel", 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: `
78
116
  @let lbl = label();
79
117
  @let cnm = controlName();
80
- @let err = error();
81
118
  @let hnt = hint();
82
119
  @let rqrd = required();
83
120
 
@@ -102,7 +139,7 @@ class EgFormSelect {
102
139
  <hlm-select-value [placeholder]="placeholder()" />
103
140
  </hlm-select-trigger>
104
141
 
105
- <hlm-select-content>
142
+ <hlm-select-content *hlmSelectPortal>
106
143
  @if (options().length) {
107
144
  @if (optionsLabel()) {
108
145
  <hlm-select-label>{{ optionsLabel() }}</hlm-select-label>
@@ -124,7 +161,7 @@ class EgFormSelect {
124
161
  <hlm-select-value [placeholder]="placeholder()" />
125
162
  </hlm-select-trigger>
126
163
 
127
- <hlm-select-content>
164
+ <hlm-select-content *hlmSelectPortal>
128
165
  @if (options().length) {
129
166
  @if (optionsLabel()) {
130
167
  <hlm-select-label>{{ optionsLabel() }}</hlm-select-label>
@@ -137,9 +174,9 @@ class EgFormSelect {
137
174
  </brn-select>
138
175
  }
139
176
 
140
- @if (err) {
177
+ @if (showError()) {
141
178
  <hlm-error [id]="errorId()" [class]="$errorClass()">
142
- {{ err }}
179
+ {{ resolvedError() }}
143
180
  </hlm-error>
144
181
  }
145
182
 
@@ -149,7 +186,7 @@ class EgFormSelect {
149
186
  </hlm-hint>
150
187
  }
151
188
  </hlm-form-field>
152
- `, 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: "directive", type: i2.HlmSelect, selector: "[hlmSelect],hlm-select" }, { kind: "component", type: i2.HlmSelectContent, selector: "hlm-select-content", inputs: ["showScroll"] }, { kind: "component", type: i2.HlmSelectItem, selector: "hlm-select-item" }, { kind: "directive", type: i2.HlmSelectLabel, selector: "[hlmSelectLabel],hlm-select-label" }, { kind: "component", type: i2.HlmSelectTrigger, selector: "hlm-select-trigger", inputs: ["class", "buttonId", "ariaDescribedby", "wrapperDisabled", "size", "forceInvalid"] }, { kind: "directive", type: i2.HlmSelectValue, selector: "[hlmSelectValue],hlm-select-value" }] });
189
+ `, 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: "directive", type: i2.HlmSelect, selector: "[hlmSelect],hlm-select" }, { kind: "component", type: i2.HlmSelectContent, selector: "hlm-select-content", inputs: ["showScroll"] }, { kind: "component", type: i2.HlmSelectItem, selector: "hlm-select-item" }, { kind: "directive", type: i2.HlmSelectLabel, selector: "[hlmSelectLabel],hlm-select-label" }, { kind: "directive", type: i2.HlmSelectPortal, selector: "[hlmSelectPortal]" }, { kind: "component", type: i2.HlmSelectTrigger, selector: "hlm-select-trigger", inputs: ["class", "buttonId", "ariaDescribedby", "wrapperDisabled", "size", "forceInvalid"] }, { kind: "directive", type: i2.HlmSelectValue, selector: "[hlmSelectValue],hlm-select-value" }] });
153
190
  }
154
191
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: EgFormSelect, decorators: [{
155
192
  type: Component,
@@ -157,7 +194,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImpor
157
194
  selector: 'eg-form-select',
158
195
  standalone: true,
159
196
  host: {
160
- class: 'tw:w-full',
197
+ '[class]': '$userClass()',
161
198
  },
162
199
  imports: [
163
200
  ReactiveFormsModule,
@@ -178,7 +215,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImpor
178
215
  template: `
179
216
  @let lbl = label();
180
217
  @let cnm = controlName();
181
- @let err = error();
182
218
  @let hnt = hint();
183
219
  @let rqrd = required();
184
220
 
@@ -203,7 +239,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImpor
203
239
  <hlm-select-value [placeholder]="placeholder()" />
204
240
  </hlm-select-trigger>
205
241
 
206
- <hlm-select-content>
242
+ <hlm-select-content *hlmSelectPortal>
207
243
  @if (options().length) {
208
244
  @if (optionsLabel()) {
209
245
  <hlm-select-label>{{ optionsLabel() }}</hlm-select-label>
@@ -225,7 +261,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImpor
225
261
  <hlm-select-value [placeholder]="placeholder()" />
226
262
  </hlm-select-trigger>
227
263
 
228
- <hlm-select-content>
264
+ <hlm-select-content *hlmSelectPortal>
229
265
  @if (options().length) {
230
266
  @if (optionsLabel()) {
231
267
  <hlm-select-label>{{ optionsLabel() }}</hlm-select-label>
@@ -238,9 +274,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImpor
238
274
  </brn-select>
239
275
  }
240
276
 
241
- @if (err) {
277
+ @if (showError()) {
242
278
  <hlm-error [id]="errorId()" [class]="$errorClass()">
243
- {{ err }}
279
+ {{ resolvedError() }}
244
280
  </hlm-error>
245
281
  }
246
282
 
@@ -252,7 +288,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImpor
252
288
  </hlm-form-field>
253
289
  `,
254
290
  }]
255
- }], propDecorators: { label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], controlId: [{ type: i0.Input, args: [{ isSignal: true, alias: "controlId", required: false }] }], controlName: [{ type: i0.Input, args: [{ isSignal: true, alias: "controlName", required: false }] }], error: [{ type: i0.Input, args: [{ isSignal: true, alias: "error", required: false }] }], hint: [{ type: i0.Input, args: [{ isSignal: true, alias: "hint", required: false }] }], id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }], multiple: [{ type: i0.Input, args: [{ isSignal: true, alias: "multiple", required: false }] }], options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }], optionsLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "optionsLabel", 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 }] }] } });
291
+ }], 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 }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }], multiple: [{ type: i0.Input, args: [{ isSignal: true, alias: "multiple", required: false }] }], options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }], optionsLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "optionsLabel", 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 }] }] } });
256
292
 
257
293
  /*
258
294
  * Public API Surface of form-select
@@ -262,5 +298,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImpor
262
298
  * Generated bundle index. Do not edit.
263
299
  */
264
300
 
265
- export { EgFormSelect };
301
+ export { EgFormSelect, injectEgFormSelectConfig, provideEgFormSelectConfig };
266
302
 
@@ -1,4 +1,5 @@
1
1
  import * as _angular_core from '@angular/core';
2
+ import { ValueProvider } from '@angular/core';
2
3
  import { ClassValue } from 'clsx';
3
4
 
4
5
  interface SelectOption {
@@ -7,11 +8,19 @@ interface SelectOption {
7
8
  }
8
9
  declare class EgFormSelect {
9
10
  private readonly formGroupDirective;
11
+ private readonly _errorMessages;
10
12
  private readonly generatedId;
13
+ private readonly _config;
11
14
  label: _angular_core.InputSignal<string | undefined>;
12
15
  controlId: _angular_core.InputSignal<string | undefined>;
13
16
  controlName: _angular_core.InputSignal<string>;
14
17
  error: _angular_core.InputSignal<string | undefined>;
18
+ /**
19
+ * Auto-resolve the displayed message from the control's `ValidationErrors`
20
+ * when `error()` is unset. Explicit `error()` always wins. Set to `false`
21
+ * for manual-only messages.
22
+ */
23
+ autoError: _angular_core.InputSignal<boolean>;
15
24
  hint: _angular_core.InputSignal<string | undefined>;
16
25
  id: _angular_core.InputSignal<string | undefined>;
17
26
  placeholder: _angular_core.InputSignal<string>;
@@ -20,6 +29,19 @@ declare class EgFormSelect {
20
29
  readonly effectiveId: _angular_core.Signal<string>;
21
30
  readonly errorId: _angular_core.Signal<string>;
22
31
  readonly hintId: _angular_core.Signal<string>;
32
+ /**
33
+ * Displayed message: explicit `error()` wins; otherwise (when `autoError()`)
34
+ * auto-resolved from the control's `ValidationErrors`. Plain method (not a
35
+ * computed): `ValidationErrors` is not a signal, so the control must be read
36
+ * fresh on every change-detection pass.
37
+ */
38
+ protected resolvedError(): string | undefined;
39
+ /**
40
+ * Whether the error is surfaced: message present + control invalid +
41
+ * touched/dirty/submitted. Gates the visual `<hlm-error>` (and
42
+ * `describedBy()`, where present) so sighted and screen-reader output agree.
43
+ */
44
+ protected showError(): boolean;
23
45
  describedBy(): string | null;
24
46
  multiple: _angular_core.InputSignal<boolean>;
25
47
  options: _angular_core.InputSignal<SelectOption[]>;
@@ -35,7 +57,22 @@ declare class EgFormSelect {
35
57
  $errorClass: _angular_core.Signal<string>;
36
58
  $hintClass: _angular_core.Signal<string>;
37
59
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<EgFormSelect, never>;
38
- static ɵcmp: _angular_core.ɵɵComponentDeclaration<EgFormSelect, "eg-form-select", never, { "label": { "alias": "label"; "required": false; "isSignal": true; }; "controlId": { "alias": "controlId"; "required": false; "isSignal": true; }; "controlName": { "alias": "controlName"; "required": false; "isSignal": true; }; "error": { "alias": "error"; "required": false; "isSignal": true; }; "hint": { "alias": "hint"; "required": false; "isSignal": true; }; "id": { "alias": "id"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "required": { "alias": "required"; "required": false; "isSignal": true; }; "multiple": { "alias": "multiple"; "required": false; "isSignal": true; }; "options": { "alias": "options"; "required": false; "isSignal": true; }; "optionsLabel": { "alias": "optionsLabel"; "required": false; "isSignal": true; }; "userClass": { "alias": "class"; "required": false; "isSignal": true; }; "labelClass": { "alias": "labelClass"; "required": false; "isSignal": true; }; "selectClass": { "alias": "selectClass"; "required": false; "isSignal": true; }; "errorClass": { "alias": "errorClass"; "required": false; "isSignal": true; }; "hintClass": { "alias": "hintClass"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
60
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<EgFormSelect, "eg-form-select", 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; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "required": { "alias": "required"; "required": false; "isSignal": true; }; "multiple": { "alias": "multiple"; "required": false; "isSignal": true; }; "options": { "alias": "options"; "required": false; "isSignal": true; }; "optionsLabel": { "alias": "optionsLabel"; "required": false; "isSignal": true; }; "userClass": { "alias": "class"; "required": false; "isSignal": true; }; "labelClass": { "alias": "labelClass"; "required": false; "isSignal": true; }; "selectClass": { "alias": "selectClass"; "required": false; "isSignal": true; }; "errorClass": { "alias": "errorClass"; "required": false; "isSignal": true; }; "hintClass": { "alias": "hintClass"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
39
61
  }
40
62
 
41
- export { EgFormSelect };
63
+ interface EgFormSelectConfig {
64
+ /**
65
+ * Global class defaults for `eg-form-select` 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
+ selectClass?: string;
71
+ errorClass?: string;
72
+ hintClass?: string;
73
+ }
74
+ declare function provideEgFormSelectConfig(config: Partial<EgFormSelectConfig>): ValueProvider;
75
+ declare function injectEgFormSelectConfig(): EgFormSelectConfig;
76
+
77
+ export { EgFormSelect, injectEgFormSelectConfig, provideEgFormSelectConfig };
78
+ export type { EgFormSelectConfig };