ng-primitives 0.34.0 → 0.36.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 (226) hide show
  1. package/a11y/index.d.ts +1 -1
  2. package/a11y/visually-hidden/visually-hidden-state.d.ts +52 -0
  3. package/a11y/visually-hidden/visually-hidden.d.ts +1 -0
  4. package/accordion/accordion/accordion-state.d.ts +1 -1
  5. package/accordion/accordion-item/accordion-item-state.d.ts +1 -1
  6. package/avatar/avatar/avatar-state.d.ts +1 -1
  7. package/avatar/avatar-image/avatar-image.d.ts +36 -1
  8. package/button/button/button-state.d.ts +12 -2
  9. package/button/button/button.d.ts +1 -2
  10. package/button/index.d.ts +1 -1
  11. package/checkbox/checkbox/checkbox-state.d.ts +1 -1
  12. package/checkbox/checkbox/checkbox.d.ts +3 -4
  13. package/date-picker/date-picker/date-picker-state.d.ts +1 -1
  14. package/date-picker/date-picker-date-button/date-picker-date-button.d.ts +1 -2
  15. package/date-picker/date-picker-next-month/date-picker-next-month.d.ts +2 -2
  16. package/date-picker/date-picker-previous-month/date-picker-previous-month.d.ts +2 -2
  17. package/date-picker/index.d.ts +5 -9
  18. package/dialog/dialog/dialog-state.d.ts +1 -1
  19. package/dialog/index.d.ts +0 -4
  20. package/fesm2022/ng-primitives-a11y.mjs +20 -9
  21. package/fesm2022/ng-primitives-a11y.mjs.map +1 -1
  22. package/fesm2022/ng-primitives-avatar.mjs +3 -3
  23. package/fesm2022/ng-primitives-avatar.mjs.map +1 -1
  24. package/fesm2022/ng-primitives-button.mjs +18 -5
  25. package/fesm2022/ng-primitives-button.mjs.map +1 -1
  26. package/fesm2022/ng-primitives-checkbox.mjs +13 -8
  27. package/fesm2022/ng-primitives-checkbox.mjs.map +1 -1
  28. package/fesm2022/ng-primitives-date-picker.mjs +13 -65
  29. package/fesm2022/ng-primitives-date-picker.mjs.map +1 -1
  30. package/fesm2022/ng-primitives-dialog.mjs +5 -41
  31. package/fesm2022/ng-primitives-dialog.mjs.map +1 -1
  32. package/fesm2022/ng-primitives-file-upload.mjs +12 -5
  33. package/fesm2022/ng-primitives-file-upload.mjs.map +1 -1
  34. package/fesm2022/ng-primitives-focus-trap.mjs +3 -12
  35. package/fesm2022/ng-primitives-focus-trap.mjs.map +1 -1
  36. package/fesm2022/ng-primitives-form-field.mjs +103 -93
  37. package/fesm2022/ng-primitives-form-field.mjs.map +1 -1
  38. package/fesm2022/ng-primitives-input.mjs +34 -21
  39. package/fesm2022/ng-primitives-input.mjs.map +1 -1
  40. package/fesm2022/ng-primitives-interactions.mjs +14 -80
  41. package/fesm2022/ng-primitives-interactions.mjs.map +1 -1
  42. package/fesm2022/ng-primitives-internal.mjs +93 -65
  43. package/fesm2022/ng-primitives-internal.mjs.map +1 -1
  44. package/fesm2022/ng-primitives-listbox.mjs +19 -48
  45. package/fesm2022/ng-primitives-listbox.mjs.map +1 -1
  46. package/fesm2022/ng-primitives-menu.mjs +1 -5
  47. package/fesm2022/ng-primitives-menu.mjs.map +1 -1
  48. package/fesm2022/ng-primitives-pagination.mjs +53 -147
  49. package/fesm2022/ng-primitives-pagination.mjs.map +1 -1
  50. package/fesm2022/ng-primitives-popover.mjs +105 -96
  51. package/fesm2022/ng-primitives-popover.mjs.map +1 -1
  52. package/fesm2022/ng-primitives-progress.mjs +4 -18
  53. package/fesm2022/ng-primitives-progress.mjs.map +1 -1
  54. package/fesm2022/ng-primitives-radio.mjs +9 -5
  55. package/fesm2022/ng-primitives-radio.mjs.map +1 -1
  56. package/fesm2022/ng-primitives-roving-focus.mjs +2 -12
  57. package/fesm2022/ng-primitives-roving-focus.mjs.map +1 -1
  58. package/fesm2022/ng-primitives-select.mjs +35 -21
  59. package/fesm2022/ng-primitives-select.mjs.map +1 -1
  60. package/fesm2022/ng-primitives-separator.mjs +2 -11
  61. package/fesm2022/ng-primitives-separator.mjs.map +1 -1
  62. package/fesm2022/ng-primitives-slider.mjs +62 -120
  63. package/fesm2022/ng-primitives-slider.mjs.map +1 -1
  64. package/fesm2022/ng-primitives-state.mjs +10 -3
  65. package/fesm2022/ng-primitives-state.mjs.map +1 -1
  66. package/fesm2022/ng-primitives-switch.mjs +22 -35
  67. package/fesm2022/ng-primitives-switch.mjs.map +1 -1
  68. package/fesm2022/ng-primitives-tabs.mjs +17 -22
  69. package/fesm2022/ng-primitives-tabs.mjs.map +1 -1
  70. package/fesm2022/ng-primitives-textarea.mjs +34 -21
  71. package/fesm2022/ng-primitives-textarea.mjs.map +1 -1
  72. package/fesm2022/ng-primitives-toast.mjs +27 -16
  73. package/fesm2022/ng-primitives-toast.mjs.map +1 -1
  74. package/fesm2022/ng-primitives-toggle-group.mjs +26 -49
  75. package/fesm2022/ng-primitives-toggle-group.mjs.map +1 -1
  76. package/fesm2022/ng-primitives-toggle.mjs +4 -18
  77. package/fesm2022/ng-primitives-toggle.mjs.map +1 -1
  78. package/fesm2022/ng-primitives-toolbar.mjs +3 -18
  79. package/fesm2022/ng-primitives-toolbar.mjs.map +1 -1
  80. package/fesm2022/ng-primitives-tooltip.mjs +103 -82
  81. package/fesm2022/ng-primitives-tooltip.mjs.map +1 -1
  82. package/fesm2022/ng-primitives-utils.mjs +18 -0
  83. package/fesm2022/ng-primitives-utils.mjs.map +1 -1
  84. package/file-upload/file-dropzone/file-dropzone-state.d.ts +2 -2
  85. package/file-upload/file-dropzone/file-dropzone.d.ts +3 -2
  86. package/file-upload/file-upload/file-upload-state.d.ts +2 -2
  87. package/file-upload/file-upload/file-upload.d.ts +3 -2
  88. package/focus-trap/index.d.ts +0 -1
  89. package/form-field/description/description.d.ts +25 -1
  90. package/form-field/error/error.d.ts +25 -1
  91. package/form-field/form-control/form-control-state.d.ts +58 -0
  92. package/form-field/form-control/form-control.d.ts +36 -7
  93. package/form-field/form-field/form-field-state.d.ts +41 -0
  94. package/form-field/form-field/form-field.d.ts +4 -0
  95. package/form-field/index.d.ts +2 -5
  96. package/form-field/label/label.d.ts +26 -2
  97. package/input/index.d.ts +1 -1
  98. package/input/input/input-state.d.ts +30 -0
  99. package/input/input/input.d.ts +7 -5
  100. package/interactions/focus/focus.d.ts +0 -4
  101. package/interactions/focus-visible/focus-visible.d.ts +0 -4
  102. package/interactions/hover/hover.d.ts +0 -4
  103. package/interactions/index.d.ts +0 -5
  104. package/interactions/move/move.d.ts +0 -4
  105. package/interactions/press/press.d.ts +0 -4
  106. package/internal/exit-animation/exit-animation-manager.d.ts +17 -0
  107. package/internal/exit-animation/exit-animation.d.ts +4 -17
  108. package/internal/index.d.ts +3 -2
  109. package/internal/interactions/interactions.d.ts +5 -1
  110. package/internal/signals/sync-state.d.ts +2 -0
  111. package/listbox/index.d.ts +0 -4
  112. package/listbox/listbox/listbox-state.d.ts +2 -2
  113. package/package.json +9 -9
  114. package/pagination/index.d.ts +0 -6
  115. package/pagination/pagination/pagination-state.d.ts +2 -2
  116. package/pagination/pagination/pagination.d.ts +5 -5
  117. package/pagination/pagination-button/pagination-button.d.ts +4 -8
  118. package/pagination/pagination-first/pagination-first.d.ts +4 -8
  119. package/pagination/pagination-last/pagination-last.d.ts +3 -7
  120. package/pagination/pagination-next/pagination-next.d.ts +4 -8
  121. package/pagination/pagination-previous/pagination-previous.d.ts +4 -8
  122. package/popover/index.d.ts +1 -2
  123. package/popover/popover/popover-token.d.ts +8 -5
  124. package/popover/popover/popover.d.ts +3 -2
  125. package/popover/popover-trigger/popover-trigger-state.d.ts +5 -3
  126. package/popover/popover-trigger/popover-trigger.d.ts +27 -19
  127. package/progress/index.d.ts +0 -1
  128. package/progress/progress/progress-state.d.ts +1 -1
  129. package/radio/radio-group/radio-group-state.d.ts +1 -1
  130. package/radio/radio-group/radio-group.d.ts +2 -2
  131. package/radio/radio-item/radio-item-state.d.ts +1 -1
  132. package/roving-focus/index.d.ts +2 -3
  133. package/roving-focus/roving-focus-group/roving-focus-group-state.d.ts +1 -1
  134. package/schematics/ng-generate/schema.d.ts +4 -1
  135. package/schematics/ng-generate/schema.json +4 -1
  136. package/schematics/ng-generate/templates/toast/toast.__fileSuffix@dasherize__.ts.template +111 -0
  137. package/schematics/ng-generate/templates/toolbar/toolbar-button.__fileSuffix@dasherize__.ts.template +58 -0
  138. package/schematics/ng-generate/templates/toolbar/toolbar.__fileSuffix@dasherize__.ts.template +29 -0
  139. package/schematics/ng-generate/templates/tooltip/tooltip-trigger.__fileSuffix@dasherize__.ts.template +35 -0
  140. package/schematics/ng-generate/templates/tooltip/tooltip.__fileSuffix@dasherize__.ts.template +60 -0
  141. package/search/search/search-state.d.ts +1 -1
  142. package/select/index.d.ts +1 -1
  143. package/select/select/select-state.d.ts +20 -0
  144. package/select/select/select.d.ts +7 -4
  145. package/separator/index.d.ts +1 -2
  146. package/slider/index.d.ts +0 -4
  147. package/slider/slider/slider-state.d.ts +1 -1
  148. package/slider/slider/slider.d.ts +2 -2
  149. package/slider/slider-range/slider-range.d.ts +1 -1
  150. package/slider/slider-thumb/slider-thumb.d.ts +3 -7
  151. package/slider/slider-track/slider-track.d.ts +1 -5
  152. package/state/index.d.ts +7 -1
  153. package/switch/index.d.ts +0 -1
  154. package/switch/switch/switch-state.d.ts +1 -1
  155. package/switch/switch/switch.d.ts +3 -4
  156. package/switch/switch-thumb/switch-thumb.d.ts +2 -2
  157. package/tabs/index.d.ts +1 -2
  158. package/tabs/tab-button/tab-button.d.ts +2 -2
  159. package/tabs/tabset/tabset-state.d.ts +1 -1
  160. package/textarea/index.d.ts +1 -1
  161. package/textarea/textarea/textarea-state.d.ts +20 -0
  162. package/textarea/textarea/textarea.d.ts +7 -4
  163. package/toast/index.d.ts +0 -1
  164. package/toast/toast/toast.d.ts +21 -1
  165. package/toggle/index.d.ts +0 -1
  166. package/toggle/toggle/toggle-state.d.ts +1 -1
  167. package/toggle-group/index.d.ts +0 -2
  168. package/toggle-group/toggle-group/toggle-group-state.d.ts +1 -1
  169. package/toggle-group/toggle-group-item/toggle-group-item-state.d.ts +15 -2
  170. package/toggle-group/toggle-group-item/toggle-group-item.d.ts +1 -1
  171. package/toolbar/index.d.ts +0 -1
  172. package/tooltip/index.d.ts +1 -2
  173. package/tooltip/tooltip/tooltip-token.d.ts +8 -5
  174. package/tooltip/tooltip/tooltip.d.ts +2 -1
  175. package/tooltip/tooltip-trigger/tooltip-trigger-state.d.ts +3 -3
  176. package/tooltip/tooltip-trigger/tooltip-trigger.d.ts +43 -22
  177. package/a11y/visually-hidden/visually-hidden-token.d.ts +0 -7
  178. package/date-picker/date-picker-cell/date-picker-cell-token.d.ts +0 -7
  179. package/date-picker/date-picker-grid/date-picker-grid-token.d.ts +0 -7
  180. package/date-picker/date-picker-next-month/date-picker-next-month-token.d.ts +0 -7
  181. package/date-picker/date-picker-previous-month/date-picker-previous-month-token.d.ts +0 -7
  182. package/dialog/dialog-description/dialog-description-token.d.ts +0 -7
  183. package/dialog/dialog-overlay/dialog-overlay-token.d.ts +0 -7
  184. package/dialog/dialog-title/dialog-title-token.d.ts +0 -7
  185. package/dialog/dialog-trigger/dialog-trigger-token.d.ts +0 -7
  186. package/focus-trap/focus-trap/focus-trap-token.d.ts +0 -7
  187. package/form-field/description/description-token.d.ts +0 -7
  188. package/form-field/error/error-token.d.ts +0 -7
  189. package/form-field/form-control/form-control-token.d.ts +0 -7
  190. package/form-field/form-field/form-field-token.d.ts +0 -8
  191. package/form-field/label/label-token.d.ts +0 -7
  192. package/input/input/input-token.d.ts +0 -7
  193. package/interactions/focus/focus-token.d.ts +0 -7
  194. package/interactions/focus-visible/focus-visible-token.d.ts +0 -7
  195. package/interactions/hover/hover-token.d.ts +0 -8
  196. package/interactions/move/move-token.d.ts +0 -7
  197. package/interactions/press/press-token.d.ts +0 -7
  198. package/internal/disabled/disabled.d.ts +0 -14
  199. package/listbox/listbox/listbox-token.d.ts +0 -7
  200. package/listbox/listbox-option/listbox-option-token.d.ts +0 -7
  201. package/listbox/listbox-section/listbox-section-token.d.ts +0 -7
  202. package/listbox/listbox-trigger/listbox-trigger-token.d.ts +0 -7
  203. package/pagination/pagination/pagination-token.d.ts +0 -8
  204. package/pagination/pagination-button/pagination-button-token.d.ts +0 -7
  205. package/pagination/pagination-first/pagination-first-token.d.ts +0 -7
  206. package/pagination/pagination-last/pagination-last-token.d.ts +0 -7
  207. package/pagination/pagination-next/pagination-next-token.d.ts +0 -7
  208. package/pagination/pagination-previous/pagination-previous-token.d.ts +0 -7
  209. package/popover/popover-trigger/popover-trigger-token.d.ts +0 -12
  210. package/progress/progress/progress-token.d.ts +0 -11
  211. package/roving-focus/roving-focus-item/roving-focus-item-token.d.ts +0 -8
  212. package/select/select/select-token.d.ts +0 -7
  213. package/separator/separator/separator-token.d.ts +0 -7
  214. package/slider/slider/slider-token.d.ts +0 -8
  215. package/slider/slider-range/slider-range-token.d.ts +0 -8
  216. package/slider/slider-thumb/slider-thumb-token.d.ts +0 -8
  217. package/slider/slider-track/slider-track-token.d.ts +0 -8
  218. package/switch/switch/switch-token.d.ts +0 -11
  219. package/tabs/tabset/tabset-token.d.ts +0 -11
  220. package/textarea/textarea/textarea-token.d.ts +0 -7
  221. package/toast/toast/toast-token.d.ts +0 -7
  222. package/toggle/toggle/toggle-token.d.ts +0 -11
  223. package/toggle-group/toggle-group/toggle-group-token.d.ts +0 -11
  224. package/toggle-group/toggle-group-item/toggle-group-item-token.d.ts +0 -11
  225. package/toolbar/toolbar/toolbar-token.d.ts +0 -11
  226. package/tooltip/tooltip-trigger/tooltip-trigger-token.d.ts +0 -15
@@ -1,25 +1,26 @@
1
1
  import * as i0 from '@angular/core';
2
- import { InjectionToken, inject, input, effect, Directive, computed, signal, contentChild, ElementRef, HostListener } from '@angular/core';
2
+ import { input, effect, Directive, computed, booleanAttribute, signal, contentChild, inject, ElementRef, HostListener } from '@angular/core';
3
3
  import { uniqueId, onBooleanChange, onChange } from 'ng-primitives/utils';
4
- import { injectDisabled } from 'ng-primitives/internal';
4
+ import { createStateToken, createStateProvider, createStateInjector, createState } from 'ng-primitives/state';
5
+ import { syncState } from 'ng-primitives/internal';
5
6
  import { NgControl } from '@angular/forms';
6
7
 
7
- const NgpFormFieldToken = new InjectionToken('NgpFormFieldToken');
8
8
  /**
9
- * Inject the FormField directive instance
10
- * @param primitive
9
+ * The state token for the FormField primitive.
11
10
  */
12
- function injectFormField() {
13
- return inject(NgpFormFieldToken, { optional: true });
14
- }
15
-
16
- const NgpDescriptionToken = new InjectionToken('NgpDescriptionToken');
11
+ const NgpFormFieldStateToken = createStateToken('FormField');
17
12
  /**
18
- * Inject the Description directive instance
13
+ * Provides the FormField state.
19
14
  */
20
- function injectDescription() {
21
- return inject(NgpDescriptionToken);
22
- }
15
+ const provideFormFieldState = createStateProvider(NgpFormFieldStateToken);
16
+ /**
17
+ * Injects the FormField state.
18
+ */
19
+ const injectFormFieldState = createStateInjector(NgpFormFieldStateToken);
20
+ /**
21
+ * The FormField state registration function.
22
+ */
23
+ const formFieldState = createState(NgpFormFieldStateToken);
23
24
 
24
25
  /**
25
26
  * The `NgpDescription` directive is used to mark a description element within a form field. There may be multiple descriptions associated with a form control.
@@ -33,42 +34,33 @@ class NgpDescription {
33
34
  /**
34
35
  * Access the form field that the description is associated with.
35
36
  */
36
- this.formField = injectFormField();
37
+ this.formField = injectFormFieldState({ optional: true });
37
38
  effect(onCleanup => {
38
- this.formField?.addDescription(this.id());
39
- onCleanup(() => this.formField?.removeDescription(this.id()));
39
+ this.formField()?.addDescription(this.id());
40
+ onCleanup(() => this.formField()?.removeDescription(this.id()));
40
41
  });
41
42
  }
42
43
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: NgpDescription, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
43
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.0.7", type: NgpDescription, isStandalone: true, selector: "[ngpDescription]", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "attr.id": "id()", "attr.data-invalid": "formField?.invalid() ? \"\" : null", "attr.data-valid": "formField?.valid() ? \"\" : null", "attr.data-touched": "formField?.touched() ? \"\" : null", "attr.data-pristine": "formField?.pristine() ? \"\" : null", "attr.data-dirty": "formField?.dirty() ? \"\" : null", "attr.data-pending": "formField?.pending() ? \"\" : null", "attr.data-disabled": "formField?.disabled() ? \"\" : null" } }, providers: [{ provide: NgpDescriptionToken, useExisting: NgpDescription }], exportAs: ["ngpDescription"], ngImport: i0 }); }
44
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.0.7", type: NgpDescription, isStandalone: true, selector: "[ngpDescription]", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "attr.id": "id()", "attr.data-invalid": "formField()?.invalid() ? \"\" : null", "attr.data-valid": "formField()?.valid() ? \"\" : null", "attr.data-touched": "formField()?.touched() ? \"\" : null", "attr.data-pristine": "formField()?.pristine() ? \"\" : null", "attr.data-dirty": "formField()?.dirty() ? \"\" : null", "attr.data-pending": "formField()?.pending() ? \"\" : null", "attr.data-disabled": "formField()?.disabled() ? \"\" : null" } }, exportAs: ["ngpDescription"], ngImport: i0 }); }
44
45
  }
45
46
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: NgpDescription, decorators: [{
46
47
  type: Directive,
47
48
  args: [{
48
49
  selector: '[ngpDescription]',
49
50
  exportAs: 'ngpDescription',
50
- providers: [{ provide: NgpDescriptionToken, useExisting: NgpDescription }],
51
51
  host: {
52
52
  '[attr.id]': 'id()',
53
- '[attr.data-invalid]': 'formField?.invalid() ? "" : null',
54
- '[attr.data-valid]': 'formField?.valid() ? "" : null',
55
- '[attr.data-touched]': 'formField?.touched() ? "" : null',
56
- '[attr.data-pristine]': 'formField?.pristine() ? "" : null',
57
- '[attr.data-dirty]': 'formField?.dirty() ? "" : null',
58
- '[attr.data-pending]': 'formField?.pending() ? "" : null',
59
- '[attr.data-disabled]': 'formField?.disabled() ? "" : null',
53
+ '[attr.data-invalid]': 'formField()?.invalid() ? "" : null',
54
+ '[attr.data-valid]': 'formField()?.valid() ? "" : null',
55
+ '[attr.data-touched]': 'formField()?.touched() ? "" : null',
56
+ '[attr.data-pristine]': 'formField()?.pristine() ? "" : null',
57
+ '[attr.data-dirty]': 'formField()?.dirty() ? "" : null',
58
+ '[attr.data-pending]': 'formField()?.pending() ? "" : null',
59
+ '[attr.data-disabled]': 'formField()?.disabled() ? "" : null',
60
60
  },
61
61
  }]
62
62
  }], ctorParameters: () => [] });
63
63
 
64
- const NgpErrorToken = new InjectionToken('NgpErrorToken');
65
- /**
66
- * Inject the Error directive instance
67
- */
68
- function injectError() {
69
- return inject(NgpErrorToken);
70
- }
71
-
72
64
  /**
73
65
  * The `NgpError` directive is used to mark an error message element within a form field. There may be multiple error messages associated with a form control.
74
66
  */
@@ -77,7 +69,7 @@ class NgpError {
77
69
  /**
78
70
  * Access the form field that the description is associated with.
79
71
  */
80
- this.formField = injectFormField();
72
+ this.formField = injectFormFieldState({ optional: true });
81
73
  /**
82
74
  * The id of the error message. If not provided, a unique id will be generated.
83
75
  */
@@ -92,7 +84,7 @@ class NgpError {
92
84
  * Determine if there is an error message.
93
85
  */
94
86
  this.hasError = computed(() => {
95
- const errors = this.formField?.errors() ?? [];
87
+ const errors = this.formField()?.errors() ?? [];
96
88
  const validator = this.validator();
97
89
  return validator ? errors?.includes(validator) : errors?.length > 0;
98
90
  });
@@ -101,45 +93,61 @@ class NgpError {
101
93
  */
102
94
  this.state = computed(() => (this.hasError() ? 'fail' : 'pass'));
103
95
  // add or remove the error message when the error state changes
104
- onBooleanChange(this.hasError, () => this.formField?.addDescription(this.id()), () => this.formField?.removeDescription(this.id()));
96
+ onBooleanChange(this.hasError, () => this.formField()?.addDescription(this.id()), () => this.formField()?.removeDescription(this.id()));
105
97
  }
106
98
  ngOnChanges(changes) {
107
99
  if ('id' in changes) {
108
- this.formField?.removeDescription(changes['id'].previousValue);
100
+ this.formField()?.removeDescription(changes['id'].previousValue);
109
101
  }
110
102
  }
111
103
  ngOnDestroy() {
112
- this.formField?.removeDescription(this.id());
104
+ this.formField()?.removeDescription(this.id());
113
105
  }
114
106
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: NgpError, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
115
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.0.7", type: NgpError, isStandalone: true, selector: "[ngpError]", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, validator: { classPropertyName: "validator", publicName: "ngpErrorValidator", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "attr.id": "id()", "attr.data-invalid": "formField?.invalid() ? \"\" : null", "attr.data-valid": "formField?.valid() ? \"\" : null", "attr.data-touched": "formField?.touched() ? \"\" : null", "attr.data-pristine": "formField?.pristine() ? \"\" : null", "attr.data-dirty": "formField?.dirty() ? \"\" : null", "attr.data-pending": "formField?.pending() ? \"\" : null", "attr.data-disabled": "formField?.disabled() ? \"\" : null", "attr.data-validator": "state()" } }, providers: [{ provide: NgpErrorToken, useExisting: NgpError }], exportAs: ["ngpError"], usesOnChanges: true, ngImport: i0 }); }
107
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.0.7", type: NgpError, isStandalone: true, selector: "[ngpError]", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, validator: { classPropertyName: "validator", publicName: "ngpErrorValidator", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "attr.id": "id()", "attr.data-invalid": "formField()?.invalid() ? \"\" : null", "attr.data-valid": "formField()?.valid() ? \"\" : null", "attr.data-touched": "formField()?.touched() ? \"\" : null", "attr.data-pristine": "formField()?.pristine() ? \"\" : null", "attr.data-dirty": "formField()?.dirty() ? \"\" : null", "attr.data-pending": "formField()?.pending() ? \"\" : null", "attr.data-disabled": "formField()?.disabled() ? \"\" : null", "attr.data-validator": "state()" } }, exportAs: ["ngpError"], usesOnChanges: true, ngImport: i0 }); }
116
108
  }
117
109
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: NgpError, decorators: [{
118
110
  type: Directive,
119
111
  args: [{
120
112
  selector: '[ngpError]',
121
113
  exportAs: 'ngpError',
122
- providers: [{ provide: NgpErrorToken, useExisting: NgpError }],
123
114
  host: {
124
115
  '[attr.id]': 'id()',
125
- '[attr.data-invalid]': 'formField?.invalid() ? "" : null',
126
- '[attr.data-valid]': 'formField?.valid() ? "" : null',
127
- '[attr.data-touched]': 'formField?.touched() ? "" : null',
128
- '[attr.data-pristine]': 'formField?.pristine() ? "" : null',
129
- '[attr.data-dirty]': 'formField?.dirty() ? "" : null',
130
- '[attr.data-pending]': 'formField?.pending() ? "" : null',
131
- '[attr.data-disabled]': 'formField?.disabled() ? "" : null',
116
+ '[attr.data-invalid]': 'formField()?.invalid() ? "" : null',
117
+ '[attr.data-valid]': 'formField()?.valid() ? "" : null',
118
+ '[attr.data-touched]': 'formField()?.touched() ? "" : null',
119
+ '[attr.data-pristine]': 'formField()?.pristine() ? "" : null',
120
+ '[attr.data-dirty]': 'formField()?.dirty() ? "" : null',
121
+ '[attr.data-pending]': 'formField()?.pending() ? "" : null',
122
+ '[attr.data-disabled]': 'formField()?.disabled() ? "" : null',
132
123
  '[attr.data-validator]': 'state()',
133
124
  },
134
125
  }]
135
126
  }], ctorParameters: () => [] });
136
127
 
137
- const NgpFormControlToken = new InjectionToken('NgpFormControlToken');
138
128
  /**
139
- * Inject the FormControl directive instance
129
+ * The state token for the FormControl primitive.
130
+ */
131
+ const NgpFormControlStateToken = createStateToken('FormControl');
132
+ /**
133
+ * Provides the FormControl state.
134
+ */
135
+ const provideFormControlState = createStateProvider(NgpFormControlStateToken);
136
+ /**
137
+ * Injects the FormControl state.
138
+ */
139
+ const injectFormControlState = createStateInjector(NgpFormControlStateToken);
140
+ /**
141
+ * The FormControl state registration function.
142
+ */
143
+ const formControlState = createState(NgpFormControlStateToken);
144
+ /**
145
+ * Sync the form control state with control state.
146
+ * @param disabled The disabled state of the control.
140
147
  */
141
- function injectFormControl() {
142
- return inject(NgpFormControlToken);
148
+ function syncFormControl({ disabled }) {
149
+ const formControl = injectFormControlState();
150
+ syncState(disabled, formControl().disabled);
143
151
  }
144
152
 
145
153
  /**
@@ -154,46 +162,53 @@ class NgpFormControl {
154
162
  */
155
163
  this.id = input(uniqueId('ngp-form-control'));
156
164
  /**
157
- * Access the form field that the form control is associated with.
165
+ * Whether the form control is disabled by a parent.
158
166
  */
159
- this.formField = injectFormField();
167
+ this.disabled = input(false, {
168
+ alias: 'ngpFormControlDisabled',
169
+ transform: booleanAttribute,
170
+ });
160
171
  /**
161
- * Whether the form control is disabled by a parent.
172
+ * Access the form field that the form control is associated with.
162
173
  */
163
- this.disabled = injectDisabled();
174
+ this.formField = injectFormFieldState({ optional: true });
164
175
  /**
165
176
  * Determine the aria-labelledby attribute value.
166
177
  */
167
- this.ariaLabelledBy = computed(() => this.formField?.labels().join(' '));
178
+ this.ariaLabelledBy = computed(() => this.formField()?.labels().join(' '));
168
179
  /**
169
180
  * Determine the aria-describedby attribute value.
170
181
  */
171
- this.ariaDescribedBy = computed(() => this.formField?.descriptions().join(' '));
182
+ this.ariaDescribedBy = computed(() => this.formField()?.descriptions().join(' '));
183
+ /**
184
+ * The state of the form control.
185
+ */
186
+ this.state = formControlState(this);
172
187
  effect(onCleanup => {
173
- this.formField?.setFormControl(this.id());
174
- onCleanup(() => this.formField?.removeFormControl());
188
+ this.formField()?.setFormControl(this.state.id());
189
+ onCleanup(() => this.formField()?.removeFormControl());
175
190
  });
176
191
  }
177
192
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: NgpFormControl, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
178
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.0.7", type: NgpFormControl, isStandalone: true, selector: "[ngpFormControl]", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "id": "id()", "attr.aria-labelledby": "ariaLabelledBy()", "attr.aria-describedby": "ariaDescribedBy()", "attr.data-invalid": "formField?.invalid() ? \"\" : null", "attr.data-valid": "formField?.valid() ? \"\" : null", "attr.data-touched": "formField?.touched() ? \"\" : null", "attr.data-pristine": "formField?.pristine() ? \"\" : null", "attr.data-dirty": "formField?.dirty() ? \"\" : null", "attr.data-pending": "formField?.pending() ? \"\" : null", "attr.data-disabled": "formField?.disabled() || disabled() ? \"\" : null" } }, providers: [{ provide: NgpFormControlToken, useExisting: NgpFormControl }], exportAs: ["ngpFormControl"], ngImport: i0 }); }
193
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.0.7", type: NgpFormControl, isStandalone: true, selector: "[ngpFormControl]", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "ngpFormControlDisabled", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "id": "id()", "attr.aria-labelledby": "ariaLabelledBy()", "attr.aria-describedby": "ariaDescribedBy()", "attr.data-invalid": "formField()?.invalid() ? \"\" : null", "attr.data-valid": "formField()?.valid() ? \"\" : null", "attr.data-touched": "formField()?.touched() ? \"\" : null", "attr.data-pristine": "formField()?.pristine() ? \"\" : null", "attr.data-dirty": "formField()?.dirty() ? \"\" : null", "attr.data-pending": "formField()?.pending() ? \"\" : null", "attr.data-disabled": "formField()?.disabled() || state.disabled() ? \"\" : null" } }, providers: [provideFormControlState()], exportAs: ["ngpFormControl"], ngImport: i0 }); }
179
194
  }
180
195
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: NgpFormControl, decorators: [{
181
196
  type: Directive,
182
197
  args: [{
183
198
  selector: '[ngpFormControl]',
184
199
  exportAs: 'ngpFormControl',
185
- providers: [{ provide: NgpFormControlToken, useExisting: NgpFormControl }],
200
+ providers: [provideFormControlState()],
186
201
  host: {
187
202
  '[id]': 'id()',
188
203
  '[attr.aria-labelledby]': 'ariaLabelledBy()',
189
204
  '[attr.aria-describedby]': 'ariaDescribedBy()',
190
- '[attr.data-invalid]': 'formField?.invalid() ? "" : null',
191
- '[attr.data-valid]': 'formField?.valid() ? "" : null',
192
- '[attr.data-touched]': 'formField?.touched() ? "" : null',
193
- '[attr.data-pristine]': 'formField?.pristine() ? "" : null',
194
- '[attr.data-dirty]': 'formField?.dirty() ? "" : null',
195
- '[attr.data-pending]': 'formField?.pending() ? "" : null',
196
- '[attr.data-disabled]': 'formField?.disabled() || disabled() ? "" : null',
205
+ '[attr.data-invalid]': 'formField()?.invalid() ? "" : null',
206
+ '[attr.data-valid]': 'formField()?.valid() ? "" : null',
207
+ '[attr.data-touched]': 'formField()?.touched() ? "" : null',
208
+ '[attr.data-pristine]': 'formField()?.pristine() ? "" : null',
209
+ '[attr.data-dirty]': 'formField()?.dirty() ? "" : null',
210
+ '[attr.data-pending]': 'formField()?.pending() ? "" : null',
211
+ '[attr.data-disabled]': 'formField()?.disabled() || state.disabled() ? "" : null',
197
212
  },
198
213
  }]
199
214
  }], ctorParameters: () => [] });
@@ -262,6 +277,10 @@ class NgpFormField {
262
277
  * @internal
263
278
  */
264
279
  this.disabled = signal(null);
280
+ /**
281
+ * The form field state.
282
+ */
283
+ this.state = formFieldState(this);
265
284
  // any time the ngControl changes, setup the subscriptions.
266
285
  onChange(this.ngControl, this.setupSubscriptions.bind(this));
267
286
  }
@@ -342,14 +361,14 @@ class NgpFormField {
342
361
  this.descriptions.update(descriptions => descriptions.filter(d => d !== description));
343
362
  }
344
363
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: NgpFormField, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
345
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "19.0.7", type: NgpFormField, isStandalone: true, selector: "[ngpFormField]", host: { properties: { "attr.data-invalid": "invalid() ? \"\" : null", "attr.data-valid": "valid() ? \"\" : null", "attr.data-touched": "touched() ? \"\" : null", "attr.data-pristine": "pristine() ? \"\" : null", "attr.data-dirty": "dirty() ? \"\" : null", "attr.data-pending": "pending() ? \"\" : null", "attr.data-disabled": "disabled() ? \"\" : null" } }, providers: [{ provide: NgpFormFieldToken, useExisting: NgpFormField }], queries: [{ propertyName: "ngControl", first: true, predicate: NgControl, descendants: true, isSignal: true }], exportAs: ["ngpFormField"], ngImport: i0 }); }
364
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "19.0.7", type: NgpFormField, isStandalone: true, selector: "[ngpFormField]", host: { properties: { "attr.data-invalid": "invalid() ? \"\" : null", "attr.data-valid": "valid() ? \"\" : null", "attr.data-touched": "touched() ? \"\" : null", "attr.data-pristine": "pristine() ? \"\" : null", "attr.data-dirty": "dirty() ? \"\" : null", "attr.data-pending": "pending() ? \"\" : null", "attr.data-disabled": "disabled() ? \"\" : null" } }, providers: [provideFormFieldState()], queries: [{ propertyName: "ngControl", first: true, predicate: NgControl, descendants: true, isSignal: true }], exportAs: ["ngpFormField"], ngImport: i0 }); }
346
365
  }
347
366
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: NgpFormField, decorators: [{
348
367
  type: Directive,
349
368
  args: [{
350
369
  selector: '[ngpFormField]',
351
370
  exportAs: 'ngpFormField',
352
- providers: [{ provide: NgpFormFieldToken, useExisting: NgpFormField }],
371
+ providers: [provideFormFieldState()],
353
372
  host: {
354
373
  '[attr.data-invalid]': 'invalid() ? "" : null',
355
374
  '[attr.data-valid]': 'valid() ? "" : null',
@@ -362,14 +381,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.7", ngImpor
362
381
  }]
363
382
  }], ctorParameters: () => [] });
364
383
 
365
- const NgpLabelToken = new InjectionToken('NgpLabelToken');
366
- /**
367
- * Inject the Label directive instance
368
- */
369
- function injectLabel() {
370
- return inject(NgpLabelToken);
371
- }
372
-
373
384
  /**
374
385
  * The `NgpLabel` directive is used to mark a label element within a form field. Preferably, there should use an HTML `<label>` element.
375
386
  */
@@ -382,11 +393,11 @@ class NgpLabel {
382
393
  /**
383
394
  * Access the form field that the label is associated with.
384
395
  */
385
- this.formField = injectFormField();
396
+ this.formField = injectFormFieldState({ optional: true });
386
397
  /**
387
398
  * Derive the for attribute value if the label is an HTML label element.
388
399
  */
389
- this.htmlFor = computed(() => this.formField?.formControl());
400
+ this.htmlFor = computed(() => this.formField()?.formControl());
390
401
  /**
391
402
  * Access the element that the label is associated with.
392
403
  */
@@ -396,8 +407,8 @@ class NgpLabel {
396
407
  */
397
408
  this.isLabel = this.elementRef.nativeElement instanceof HTMLLabelElement;
398
409
  effect(onCleanup => {
399
- this.formField?.addLabel(this.id());
400
- onCleanup(() => this.formField?.removeLabel(this.id()));
410
+ this.formField()?.addLabel(this.id());
411
+ onCleanup(() => this.formField()?.removeLabel(this.id()));
401
412
  });
402
413
  }
403
414
  onClick(event) {
@@ -437,24 +448,23 @@ class NgpLabel {
437
448
  target.focus({ preventScroll: true });
438
449
  }
439
450
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: NgpLabel, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
440
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.0.7", type: NgpLabel, isStandalone: true, selector: "[ngpLabel]", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "click": "onClick($event)" }, properties: { "attr.id": "id()", "attr.for": "htmlFor()", "attr.data-invalid": "formField?.invalid() ? \"\" : null", "attr.data-valid": "formField?.valid() ? \"\" : null", "attr.data-touched": "formField?.touched() ? \"\" : null", "attr.data-pristine": "formField?.pristine() ? \"\" : null", "attr.data-dirty": "formField?.dirty() ? \"\" : null", "attr.data-pending": "formField?.pending() ? \"\" : null", "attr.data-disabled": "formField?.disabled() ? \"\" : null" } }, providers: [{ provide: NgpLabelToken, useExisting: NgpLabel }], exportAs: ["ngpLabel"], ngImport: i0 }); }
451
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.0.7", type: NgpLabel, isStandalone: true, selector: "[ngpLabel]", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "click": "onClick($event)" }, properties: { "attr.id": "id()", "attr.for": "htmlFor()", "attr.data-invalid": "formField()?.invalid() ? \"\" : null", "attr.data-valid": "formField()?.valid() ? \"\" : null", "attr.data-touched": "formField()?.touched() ? \"\" : null", "attr.data-pristine": "formField()?.pristine() ? \"\" : null", "attr.data-dirty": "formField()?.dirty() ? \"\" : null", "attr.data-pending": "formField()?.pending() ? \"\" : null", "attr.data-disabled": "formField()?.disabled() ? \"\" : null" } }, exportAs: ["ngpLabel"], ngImport: i0 }); }
441
452
  }
442
453
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: NgpLabel, decorators: [{
443
454
  type: Directive,
444
455
  args: [{
445
456
  selector: '[ngpLabel]',
446
457
  exportAs: 'ngpLabel',
447
- providers: [{ provide: NgpLabelToken, useExisting: NgpLabel }],
448
458
  host: {
449
459
  '[attr.id]': 'id()',
450
460
  '[attr.for]': 'htmlFor()',
451
- '[attr.data-invalid]': 'formField?.invalid() ? "" : null',
452
- '[attr.data-valid]': 'formField?.valid() ? "" : null',
453
- '[attr.data-touched]': 'formField?.touched() ? "" : null',
454
- '[attr.data-pristine]': 'formField?.pristine() ? "" : null',
455
- '[attr.data-dirty]': 'formField?.dirty() ? "" : null',
456
- '[attr.data-pending]': 'formField?.pending() ? "" : null',
457
- '[attr.data-disabled]': 'formField?.disabled() ? "" : null',
461
+ '[attr.data-invalid]': 'formField()?.invalid() ? "" : null',
462
+ '[attr.data-valid]': 'formField()?.valid() ? "" : null',
463
+ '[attr.data-touched]': 'formField()?.touched() ? "" : null',
464
+ '[attr.data-pristine]': 'formField()?.pristine() ? "" : null',
465
+ '[attr.data-dirty]': 'formField()?.dirty() ? "" : null',
466
+ '[attr.data-pending]': 'formField()?.pending() ? "" : null',
467
+ '[attr.data-disabled]': 'formField()?.disabled() ? "" : null',
458
468
  },
459
469
  }]
460
470
  }], ctorParameters: () => [], propDecorators: { onClick: [{
@@ -466,5 +476,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.7", ngImpor
466
476
  * Generated bundle index. Do not edit.
467
477
  */
468
478
 
469
- export { NgpDescription, NgpDescriptionToken, NgpError, NgpErrorToken, NgpFormControl, NgpFormControlToken, NgpFormField, NgpFormFieldToken, NgpLabel, NgpLabelToken, injectDescription, injectError, injectFormControl, injectFormField, injectLabel };
479
+ export { NgpDescription, NgpError, NgpFormControl, NgpFormField, NgpLabel, injectFormControlState, injectFormFieldState, provideFormControlState, provideFormFieldState, syncFormControl };
470
480
  //# sourceMappingURL=ng-primitives-form-field.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"ng-primitives-form-field.mjs","sources":["../../../../packages/ng-primitives/form-field/src/form-field/form-field-token.ts","../../../../packages/ng-primitives/form-field/src/description/description-token.ts","../../../../packages/ng-primitives/form-field/src/description/description.ts","../../../../packages/ng-primitives/form-field/src/error/error-token.ts","../../../../packages/ng-primitives/form-field/src/error/error.ts","../../../../packages/ng-primitives/form-field/src/form-control/form-control-token.ts","../../../../packages/ng-primitives/form-field/src/form-control/form-control.ts","../../../../packages/ng-primitives/form-field/src/form-field/form-field.ts","../../../../packages/ng-primitives/form-field/src/label/label-token.ts","../../../../packages/ng-primitives/form-field/src/label/label.ts","../../../../packages/ng-primitives/form-field/src/ng-primitives-form-field.ts"],"sourcesContent":["import { InjectionToken, inject } from '@angular/core';\nimport type { NgpFormField } from './form-field';\n\nexport const NgpFormFieldToken = new InjectionToken<NgpFormField>('NgpFormFieldToken');\n\n/**\n * Inject the FormField directive instance\n * @param primitive\n */\nexport function injectFormField(): NgpFormField | null {\n return inject(NgpFormFieldToken, { optional: true });\n}\n","import { InjectionToken, inject } from '@angular/core';\nimport type { NgpDescription } from './description';\n\nexport const NgpDescriptionToken = new InjectionToken<NgpDescription>('NgpDescriptionToken');\n\n/**\n * Inject the Description directive instance\n */\nexport function injectDescription(): NgpDescription {\n return inject(NgpDescriptionToken);\n}\n","import { Directive, effect, input } from '@angular/core';\nimport { uniqueId } from 'ng-primitives/utils';\nimport { injectFormField } from '../form-field/form-field-token';\nimport { NgpDescriptionToken } from './description-token';\n\n/**\n * The `NgpDescription` directive is used to mark a description element within a form field. There may be multiple descriptions associated with a form control.\n */\n@Directive({\n selector: '[ngpDescription]',\n exportAs: 'ngpDescription',\n providers: [{ provide: NgpDescriptionToken, useExisting: NgpDescription }],\n host: {\n '[attr.id]': 'id()',\n '[attr.data-invalid]': 'formField?.invalid() ? \"\" : null',\n '[attr.data-valid]': 'formField?.valid() ? \"\" : null',\n '[attr.data-touched]': 'formField?.touched() ? \"\" : null',\n '[attr.data-pristine]': 'formField?.pristine() ? \"\" : null',\n '[attr.data-dirty]': 'formField?.dirty() ? \"\" : null',\n '[attr.data-pending]': 'formField?.pending() ? \"\" : null',\n '[attr.data-disabled]': 'formField?.disabled() ? \"\" : null',\n },\n})\nexport class NgpDescription {\n /**\n * The id of the description. If not provided, a unique id will be generated.\n */\n readonly id = input<string>(uniqueId('ngp-description'));\n /**\n * Access the form field that the description is associated with.\n */\n protected readonly formField = injectFormField();\n\n constructor() {\n effect(onCleanup => {\n this.formField?.addDescription(this.id());\n onCleanup(() => this.formField?.removeDescription(this.id()));\n });\n }\n}\n","import { InjectionToken, inject } from '@angular/core';\nimport type { NgpError } from './error';\n\nexport const NgpErrorToken = new InjectionToken<NgpError>('NgpErrorToken');\n\n/**\n * Inject the Error directive instance\n */\nexport function injectError(): NgpError {\n return inject(NgpErrorToken);\n}\n","import { Directive, OnChanges, OnDestroy, SimpleChanges, computed, input } from '@angular/core';\nimport { onBooleanChange, uniqueId } from 'ng-primitives/utils';\nimport { injectFormField } from '../form-field/form-field-token';\nimport { NgpErrorToken } from './error-token';\n\n/**\n * The `NgpError` directive is used to mark an error message element within a form field. There may be multiple error messages associated with a form control.\n */\n@Directive({\n selector: '[ngpError]',\n exportAs: 'ngpError',\n providers: [{ provide: NgpErrorToken, useExisting: NgpError }],\n host: {\n '[attr.id]': 'id()',\n '[attr.data-invalid]': 'formField?.invalid() ? \"\" : null',\n '[attr.data-valid]': 'formField?.valid() ? \"\" : null',\n '[attr.data-touched]': 'formField?.touched() ? \"\" : null',\n '[attr.data-pristine]': 'formField?.pristine() ? \"\" : null',\n '[attr.data-dirty]': 'formField?.dirty() ? \"\" : null',\n '[attr.data-pending]': 'formField?.pending() ? \"\" : null',\n '[attr.data-disabled]': 'formField?.disabled() ? \"\" : null',\n '[attr.data-validator]': 'state()',\n },\n})\nexport class NgpError implements OnChanges, OnDestroy {\n /**\n * Access the form field that the description is associated with.\n */\n protected readonly formField = injectFormField();\n\n /**\n * The id of the error message. If not provided, a unique id will be generated.\n */\n readonly id = input<string>(uniqueId('ngp-error'));\n\n /**\n * The validator associated with the error message.\n */\n readonly validator = input<string | null>(null, {\n alias: 'ngpErrorValidator',\n });\n\n /**\n * Determine if there is an error message.\n */\n protected readonly hasError = computed(() => {\n const errors = this.formField?.errors() ?? [];\n const validator = this.validator();\n\n return validator ? errors?.includes(validator) : errors?.length > 0;\n });\n\n /**\n * Determine whether the validator associated with this error is failing.\n */\n protected readonly state = computed(() => (this.hasError() ? 'fail' : 'pass'));\n\n constructor() {\n // add or remove the error message when the error state changes\n onBooleanChange(\n this.hasError,\n () => this.formField?.addDescription(this.id()),\n () => this.formField?.removeDescription(this.id()),\n );\n }\n\n ngOnChanges(changes: SimpleChanges): void {\n if ('id' in changes) {\n this.formField?.removeDescription(changes['id'].previousValue);\n }\n }\n\n ngOnDestroy(): void {\n this.formField?.removeDescription(this.id());\n }\n}\n","import { InjectionToken, inject } from '@angular/core';\nimport type { NgpFormControl } from './form-control';\n\nexport const NgpFormControlToken = new InjectionToken<NgpFormControl>('NgpFormControlToken');\n\n/**\n * Inject the FormControl directive instance\n */\nexport function injectFormControl(): NgpFormControl {\n return inject(NgpFormControlToken);\n}\n","import { computed, Directive, effect, input } from '@angular/core';\nimport { injectDisabled } from 'ng-primitives/internal';\nimport { uniqueId } from 'ng-primitives/utils';\nimport { injectFormField } from '../form-field/form-field-token';\nimport { NgpFormControlToken } from './form-control-token';\n\n/**\n * Typically this primitive would be not be used directly, but instead a more specific form control primitive would be used (e.g. `ngpInput`). All of our form control primitives use `ngpFormControl` internally so they will have the same accessibility features as described below.\n *\n * The `NgpFormControl` directive is used to mark a form control element within a form field. This element will have an `aria-labelledby` attribute set to the ID of the label element within the form field and an `aria-describedby` attribute set to the ID of the description elements within the form field.\n */\n@Directive({\n selector: '[ngpFormControl]',\n exportAs: 'ngpFormControl',\n providers: [{ provide: NgpFormControlToken, useExisting: NgpFormControl }],\n host: {\n '[id]': 'id()',\n '[attr.aria-labelledby]': 'ariaLabelledBy()',\n '[attr.aria-describedby]': 'ariaDescribedBy()',\n '[attr.data-invalid]': 'formField?.invalid() ? \"\" : null',\n '[attr.data-valid]': 'formField?.valid() ? \"\" : null',\n '[attr.data-touched]': 'formField?.touched() ? \"\" : null',\n '[attr.data-pristine]': 'formField?.pristine() ? \"\" : null',\n '[attr.data-dirty]': 'formField?.dirty() ? \"\" : null',\n '[attr.data-pending]': 'formField?.pending() ? \"\" : null',\n '[attr.data-disabled]': 'formField?.disabled() || disabled() ? \"\" : null',\n },\n})\nexport class NgpFormControl {\n /**\n * The id of the form control. If not provided, a unique id will be generated.\n */\n readonly id = input<string>(uniqueId('ngp-form-control'));\n /**\n * Access the form field that the form control is associated with.\n */\n protected readonly formField = injectFormField();\n /**\n * Whether the form control is disabled by a parent.\n */\n protected readonly disabled = injectDisabled();\n /**\n * Determine the aria-labelledby attribute value.\n */\n protected readonly ariaLabelledBy = computed(() => this.formField?.labels().join(' '));\n\n /**\n * Determine the aria-describedby attribute value.\n */\n protected readonly ariaDescribedBy = computed(() => this.formField?.descriptions().join(' '));\n\n constructor() {\n effect(onCleanup => {\n this.formField?.setFormControl(this.id());\n onCleanup(() => this.formField?.removeFormControl());\n });\n }\n}\n","import { Directive, OnDestroy, contentChild, signal } from '@angular/core';\nimport { NgControl } from '@angular/forms';\nimport { onChange } from 'ng-primitives/utils';\nimport { Subscription } from 'rxjs';\nimport { NgpFormFieldToken } from './form-field-token';\n\n/**\n * The `NgpFormField` directive is a container for form field elements. Any labels, form controls, or descriptions should be placed within this directive.\n */\n@Directive({\n selector: '[ngpFormField]',\n exportAs: 'ngpFormField',\n providers: [{ provide: NgpFormFieldToken, useExisting: NgpFormField }],\n host: {\n '[attr.data-invalid]': 'invalid() ? \"\" : null',\n '[attr.data-valid]': 'valid() ? \"\" : null',\n '[attr.data-touched]': 'touched() ? \"\" : null',\n '[attr.data-pristine]': 'pristine() ? \"\" : null',\n '[attr.data-dirty]': 'dirty() ? \"\" : null',\n '[attr.data-pending]': 'pending() ? \"\" : null',\n '[attr.data-disabled]': 'disabled() ? \"\" : null',\n },\n})\nexport class NgpFormField implements OnDestroy {\n /**\n * Store the form label.\n * @internal\n */\n readonly labels = signal<string[]>([]);\n\n /**\n * Store the form descriptions.\n * @internal\n */\n readonly descriptions = signal<string[]>([]);\n\n /**\n * Store the id of the associated form control.\n * @internal\n */\n readonly formControl = signal<string | null>(null);\n\n /**\n * Find any NgControl within the form field.\n * @internal\n */\n private readonly ngControl = contentChild(NgControl);\n\n /**\n * Store the validation error messages.\n * @internal\n */\n readonly errors = signal<string[]>([]);\n\n /**\n * Whether the control is pristine.\n * @internal\n */\n readonly pristine = signal<boolean | null>(null);\n\n /**\n * Whether the control is touched.\n * @internal\n */\n readonly touched = signal<boolean | null>(null);\n\n /**\n * Whether the control is dirty.\n * @internal\n */\n readonly dirty = signal<boolean | null>(null);\n\n /**\n * Whether the control is valid.\n */\n readonly valid = signal<boolean | null>(null);\n\n /**\n * Whether the control is invalid.\n * @internal\n */\n readonly invalid = signal<boolean | null>(null);\n\n /**\n * Whether the control is pending.\n * @internal\n */\n readonly pending = signal<boolean | null>(null);\n\n /**\n * Whether the control is disabled.\n * @internal\n */\n readonly disabled = signal<boolean | null>(null);\n\n /**\n * Store the current status subscription.\n */\n private subscription?: Subscription;\n\n constructor() {\n // any time the ngControl changes, setup the subscriptions.\n onChange(this.ngControl, this.setupSubscriptions.bind(this));\n }\n\n ngOnDestroy(): void {\n this.subscription?.unsubscribe();\n }\n\n /**\n * Setup a listener for the form control status.\n * @param control\n */\n private setupSubscriptions(control: NgControl | null | undefined): void {\n // Unsubscribe from the previous subscriptions.\n this.subscription?.unsubscribe();\n\n // set the initial values\n this.updateStatus();\n\n // Listen for changes to the form control.\n this.subscription = control?.valueChanges?.subscribe(this.updateStatus.bind(this));\n }\n\n private updateStatus(): void {\n const control = this.ngControl();\n\n if (!control) {\n return;\n }\n\n this.pristine.set(control.pristine);\n this.touched.set(control.touched);\n this.dirty.set(control.dirty);\n this.valid.set(control.valid);\n this.invalid.set(control.invalid);\n this.pending.set(control.pending);\n this.disabled.set(control.disabled);\n this.errors.set(control?.errors ? Object.keys(control.errors) : []);\n }\n\n /**\n * Register the id of the associated form control.\n * @param id\n * @internal\n */\n setFormControl(id: string): void {\n this.formControl.set(id);\n }\n\n /**\n * Register a label with the form field.\n * @param label\n * @internal\n */\n addLabel(label: string): void {\n this.labels.update(labels => [...labels, label]);\n }\n\n /**\n * Register a description with the form field.\n * @param description\n * @internal\n */\n addDescription(description: string): void {\n this.descriptions.update(descriptions => [...descriptions, description]);\n }\n\n /**\n * Remove the associated form control.\n * @internal\n */\n removeFormControl(): void {\n this.formControl.set(null);\n }\n\n /**\n * Remove a label from the form field.\n * @param label\n * @internal\n */\n removeLabel(label: string): void {\n this.labels.update(labels => labels.filter(l => l !== label));\n }\n\n /**\n * Remove a description from the form field.\n * @param description\n * @internal\n */\n removeDescription(description: string): void {\n this.descriptions.update(descriptions => descriptions.filter(d => d !== description));\n }\n}\n","import { InjectionToken, inject } from '@angular/core';\nimport type { NgpLabel } from './label';\n\nexport const NgpLabelToken = new InjectionToken<NgpLabel>('NgpLabelToken');\n\n/**\n * Inject the Label directive instance\n */\nexport function injectLabel(): NgpLabel {\n return inject(NgpLabelToken);\n}\n","import {\n computed,\n Directive,\n effect,\n ElementRef,\n HostListener,\n inject,\n input,\n} from '@angular/core';\nimport { uniqueId } from 'ng-primitives/utils';\nimport { injectFormField } from '../form-field/form-field-token';\nimport { NgpLabelToken } from './label-token';\n\n/**\n * The `NgpLabel` directive is used to mark a label element within a form field. Preferably, there should use an HTML `<label>` element.\n */\n@Directive({\n selector: '[ngpLabel]',\n exportAs: 'ngpLabel',\n providers: [{ provide: NgpLabelToken, useExisting: NgpLabel }],\n host: {\n '[attr.id]': 'id()',\n '[attr.for]': 'htmlFor()',\n '[attr.data-invalid]': 'formField?.invalid() ? \"\" : null',\n '[attr.data-valid]': 'formField?.valid() ? \"\" : null',\n '[attr.data-touched]': 'formField?.touched() ? \"\" : null',\n '[attr.data-pristine]': 'formField?.pristine() ? \"\" : null',\n '[attr.data-dirty]': 'formField?.dirty() ? \"\" : null',\n '[attr.data-pending]': 'formField?.pending() ? \"\" : null',\n '[attr.data-disabled]': 'formField?.disabled() ? \"\" : null',\n },\n})\nexport class NgpLabel {\n /**\n * The id of the label. If not provided, a unique id will be generated.\n */\n readonly id = input<string>(uniqueId('ngp-label'));\n /**\n * Access the form field that the label is associated with.\n */\n protected readonly formField = injectFormField();\n /**\n * Derive the for attribute value if the label is an HTML label element.\n */\n protected readonly htmlFor = computed(() => this.formField?.formControl());\n /**\n * Access the element that the label is associated with.\n */\n private readonly elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n /**\n * Determine if the label is an HTML label element.\n */\n protected readonly isLabel = this.elementRef.nativeElement instanceof HTMLLabelElement;\n\n constructor() {\n effect(onCleanup => {\n this.formField?.addLabel(this.id());\n onCleanup(() => this.formField?.removeLabel(this.id()));\n });\n }\n\n @HostListener('click', ['$event'])\n protected onClick(event: MouseEvent): void {\n // by default a label will perform a click on the associated form control, however\n // this only works if the associated form control is an input element which may not always\n // be the case, so we prevent the default behavior and handle the click event ourselves.\n // This was inspired by the HeadlessUI approach:\n // https://github.com/tailwindlabs/headlessui/blob/main/packages/%40headlessui-react/src/components/label/label.tsx#L58\n if (this.isLabel) {\n event.preventDefault();\n }\n\n // to find the associated form control we can lookup via the known id\n const targetId = this.htmlFor();\n\n if (!targetId) {\n return;\n }\n\n const target = document.getElementById(targetId);\n\n if (!target) {\n return;\n }\n\n // if the target is disabled then do nothing\n const disabled = target.getAttribute('disabled');\n const ariaDisabled = target.getAttribute('aria-disabled');\n\n if (disabled === '' || disabled === 'true' || ariaDisabled === 'true') {\n return;\n }\n\n // radio buttons, checkboxes and switches should all be clicked immediately as they require state changes\n if (\n (target instanceof HTMLInputElement &&\n (target.type === 'radio' || target.type === 'checkbox')) ||\n target.role === 'radio' ||\n target.role === 'checkbox' ||\n target.role === 'switch'\n ) {\n target.click();\n }\n\n // Move focus to the element, this allows you to start using keyboard shortcuts since the\n // bound element is now focused.\n target.focus({ preventScroll: true });\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;MAGa,iBAAiB,GAAG,IAAI,cAAc,CAAe,mBAAmB;AAErF;;;AAGG;SACa,eAAe,GAAA;IAC7B,OAAO,MAAM,CAAC,iBAAiB,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;AACtD;;MCRa,mBAAmB,GAAG,IAAI,cAAc,CAAiB,qBAAqB;AAE3F;;AAEG;SACa,iBAAiB,GAAA;AAC/B,I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UAAA,EAAA,EAAA,SAAA,EAAA,MAAA,EAAA,UAAA,EAAA,WAAA,EAAA,mBAAA,EAAA,oCAAA,EAAA,iBAAA,EAAA,kCAAA,EAAA,mBAAA,EAAA,oCAAA,EAAA,oBAAA,EAAA,qCAAA,EAAA,iBAAA,EAAA,kCAAA,EAAA,mBAAA,EAAA,oCAAA,EAAA,oBAAA,EAAA,qCAAA,EAAA,EAAA,EAAA,SAAA,EAbR,CAAC,EAAE,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,QAAQ,EAAE,CAAC,EAAA,QAAA,EAAA,CAAA,UAAA,CAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA;;2FAanD,QAAQ,EAAA,UAAA,EAAA,CAAA;kBAhBpB,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,YAAY;AACtB,oBAAA,QAAQ,EAAE,UAAU;oBACpB,SAAS,EAAE,CAAC,EAAE,OAAO,EAAE,aAAa,EAAE,WAAW,EAAU,QAAA,EAAE,CAAC;AAC9D,oBAAA,IAAI,EAAE;AACJ,wBAAA,WAAW,EAAE,MAAM;AACnB,wBAAA,YAAY,EAAE,WAAW;AACzB,wBAAA,qBAAqB,EAAE,kCAAkC;AACzD,wBAAA,mBAAmB,EAAE,gCAAgC;AACrD,wBAAA,qBAAqB,EAAE,kCAAkC;AACzD,wBAAA,sBAAsB,EAAE,mCAAmC;AAC3D,wBAAA,mBAAmB,EAAE,gCAAgC;AACrD,wBAAA,qBAAqB,EAAE,kCAAkC;AACzD,wBAAA,sBAAsB,EAAE,mCAAmC;AAC5D,qBAAA;AACF,iBAAA;wDA+BW,OAAO,EAAA,CAAA;sBADhB,YAAY;uBAAC,OAAO,EAAE,CAAC,QAAQ,CAAC;;;AC7DnC;;AAEG;;;;"}
1
+ {"version":3,"file":"ng-primitives-form-field.mjs","sources":["../../../../packages/ng-primitives/form-field/src/form-field/form-field-state.ts","../../../../packages/ng-primitives/form-field/src/description/description.ts","../../../../packages/ng-primitives/form-field/src/error/error.ts","../../../../packages/ng-primitives/form-field/src/form-control/form-control-state.ts","../../../../packages/ng-primitives/form-field/src/form-control/form-control.ts","../../../../packages/ng-primitives/form-field/src/form-field/form-field.ts","../../../../packages/ng-primitives/form-field/src/label/label.ts","../../../../packages/ng-primitives/form-field/src/ng-primitives-form-field.ts"],"sourcesContent":["import {\n createState,\n createStateInjector,\n createStateProvider,\n createStateToken,\n} from 'ng-primitives/state';\nimport type { NgpFormField } from './form-field';\n\n/**\n * The state token for the FormField primitive.\n */\nexport const NgpFormFieldStateToken = createStateToken<NgpFormField>('FormField');\n\n/**\n * Provides the FormField state.\n */\nexport const provideFormFieldState = createStateProvider(NgpFormFieldStateToken);\n\n/**\n * Injects the FormField state.\n */\nexport const injectFormFieldState = createStateInjector(NgpFormFieldStateToken);\n\n/**\n * The FormField state registration function.\n */\nexport const formFieldState = createState(NgpFormFieldStateToken);\n","import { Directive, effect, input } from '@angular/core';\nimport { uniqueId } from 'ng-primitives/utils';\nimport { injectFormFieldState } from '../form-field/form-field-state';\n\n/**\n * The `NgpDescription` directive is used to mark a description element within a form field. There may be multiple descriptions associated with a form control.\n */\n@Directive({\n selector: '[ngpDescription]',\n exportAs: 'ngpDescription',\n host: {\n '[attr.id]': 'id()',\n '[attr.data-invalid]': 'formField()?.invalid() ? \"\" : null',\n '[attr.data-valid]': 'formField()?.valid() ? \"\" : null',\n '[attr.data-touched]': 'formField()?.touched() ? \"\" : null',\n '[attr.data-pristine]': 'formField()?.pristine() ? \"\" : null',\n '[attr.data-dirty]': 'formField()?.dirty() ? \"\" : null',\n '[attr.data-pending]': 'formField()?.pending() ? \"\" : null',\n '[attr.data-disabled]': 'formField()?.disabled() ? \"\" : null',\n },\n})\nexport class NgpDescription {\n /**\n * The id of the description. If not provided, a unique id will be generated.\n */\n readonly id = input<string>(uniqueId('ngp-description'));\n /**\n * Access the form field that the description is associated with.\n */\n protected readonly formField = injectFormFieldState({ optional: true });\n\n constructor() {\n effect(onCleanup => {\n this.formField()?.addDescription(this.id());\n onCleanup(() => this.formField()?.removeDescription(this.id()));\n });\n }\n}\n","import { Directive, OnChanges, OnDestroy, SimpleChanges, computed, input } from '@angular/core';\nimport { onBooleanChange, uniqueId } from 'ng-primitives/utils';\nimport { injectFormFieldState } from '../form-field/form-field-state';\n\n/**\n * The `NgpError` directive is used to mark an error message element within a form field. There may be multiple error messages associated with a form control.\n */\n@Directive({\n selector: '[ngpError]',\n exportAs: 'ngpError',\n host: {\n '[attr.id]': 'id()',\n '[attr.data-invalid]': 'formField()?.invalid() ? \"\" : null',\n '[attr.data-valid]': 'formField()?.valid() ? \"\" : null',\n '[attr.data-touched]': 'formField()?.touched() ? \"\" : null',\n '[attr.data-pristine]': 'formField()?.pristine() ? \"\" : null',\n '[attr.data-dirty]': 'formField()?.dirty() ? \"\" : null',\n '[attr.data-pending]': 'formField()?.pending() ? \"\" : null',\n '[attr.data-disabled]': 'formField()?.disabled() ? \"\" : null',\n '[attr.data-validator]': 'state()',\n },\n})\nexport class NgpError implements OnChanges, OnDestroy {\n /**\n * Access the form field that the description is associated with.\n */\n protected readonly formField = injectFormFieldState({ optional: true });\n\n /**\n * The id of the error message. If not provided, a unique id will be generated.\n */\n readonly id = input<string>(uniqueId('ngp-error'));\n\n /**\n * The validator associated with the error message.\n */\n readonly validator = input<string | null>(null, {\n alias: 'ngpErrorValidator',\n });\n\n /**\n * Determine if there is an error message.\n */\n protected readonly hasError = computed(() => {\n const errors = this.formField()?.errors() ?? [];\n const validator = this.validator();\n\n return validator ? errors?.includes(validator) : errors?.length > 0;\n });\n\n /**\n * Determine whether the validator associated with this error is failing.\n */\n protected readonly state = computed(() => (this.hasError() ? 'fail' : 'pass'));\n\n constructor() {\n // add or remove the error message when the error state changes\n onBooleanChange(\n this.hasError,\n () => this.formField()?.addDescription(this.id()),\n () => this.formField()?.removeDescription(this.id()),\n );\n }\n\n ngOnChanges(changes: SimpleChanges): void {\n if ('id' in changes) {\n this.formField()?.removeDescription(changes['id'].previousValue);\n }\n }\n\n ngOnDestroy(): void {\n this.formField()?.removeDescription(this.id());\n }\n}\n","import { Signal } from '@angular/core';\nimport { syncState } from 'ng-primitives/internal';\nimport {\n createState,\n createStateInjector,\n createStateProvider,\n createStateToken,\n} from 'ng-primitives/state';\nimport type { NgpFormControl } from './form-control';\n\n/**\n * The state token for the FormControl primitive.\n */\nexport const NgpFormControlStateToken = createStateToken<NgpFormControl>('FormControl');\n\n/**\n * Provides the FormControl state.\n */\nexport const provideFormControlState = createStateProvider(NgpFormControlStateToken);\n\n/**\n * Injects the FormControl state.\n */\nexport const injectFormControlState = createStateInjector(NgpFormControlStateToken);\n\n/**\n * The FormControl state registration function.\n */\nexport const formControlState = createState(NgpFormControlStateToken);\n\ninterface SyncFormControl {\n disabled: Signal<boolean>;\n}\n\n/**\n * Sync the form control state with control state.\n * @param disabled The disabled state of the control.\n */\nexport function syncFormControl({ disabled }: SyncFormControl) {\n const formControl = injectFormControlState();\n syncState(disabled, formControl().disabled);\n}\n","import { BooleanInput } from '@angular/cdk/coercion';\nimport { booleanAttribute, computed, Directive, effect, input } from '@angular/core';\nimport { uniqueId } from 'ng-primitives/utils';\nimport { injectFormFieldState } from '../form-field/form-field-state';\nimport { formControlState, provideFormControlState } from './form-control-state';\n\n/**\n * Typically this primitive would be not be used directly, but instead a more specific form control primitive would be used (e.g. `ngpInput`). All of our form control primitives use `ngpFormControl` internally so they will have the same accessibility features as described below.\n *\n * The `NgpFormControl` directive is used to mark a form control element within a form field. This element will have an `aria-labelledby` attribute set to the ID of the label element within the form field and an `aria-describedby` attribute set to the ID of the description elements within the form field.\n */\n@Directive({\n selector: '[ngpFormControl]',\n exportAs: 'ngpFormControl',\n providers: [provideFormControlState()],\n host: {\n '[id]': 'id()',\n '[attr.aria-labelledby]': 'ariaLabelledBy()',\n '[attr.aria-describedby]': 'ariaDescribedBy()',\n '[attr.data-invalid]': 'formField()?.invalid() ? \"\" : null',\n '[attr.data-valid]': 'formField()?.valid() ? \"\" : null',\n '[attr.data-touched]': 'formField()?.touched() ? \"\" : null',\n '[attr.data-pristine]': 'formField()?.pristine() ? \"\" : null',\n '[attr.data-dirty]': 'formField()?.dirty() ? \"\" : null',\n '[attr.data-pending]': 'formField()?.pending() ? \"\" : null',\n '[attr.data-disabled]': 'formField()?.disabled() || state.disabled() ? \"\" : null',\n },\n})\nexport class NgpFormControl {\n /**\n * The id of the form control. If not provided, a unique id will be generated.\n */\n readonly id = input<string>(uniqueId('ngp-form-control'));\n\n /**\n * Whether the form control is disabled by a parent.\n */\n readonly disabled = input<boolean, BooleanInput>(false, {\n alias: 'ngpFormControlDisabled',\n transform: booleanAttribute,\n });\n\n /**\n * Access the form field that the form control is associated with.\n */\n protected readonly formField = injectFormFieldState({ optional: true });\n /**\n * Determine the aria-labelledby attribute value.\n */\n protected readonly ariaLabelledBy = computed(() => this.formField()?.labels().join(' '));\n\n /**\n * Determine the aria-describedby attribute value.\n */\n protected readonly ariaDescribedBy = computed(() => this.formField()?.descriptions().join(' '));\n\n /**\n * The state of the form control.\n */\n private readonly state = formControlState<NgpFormControl>(this);\n\n constructor() {\n effect(onCleanup => {\n this.formField()?.setFormControl(this.state.id());\n onCleanup(() => this.formField()?.removeFormControl());\n });\n }\n}\n","import { Directive, OnDestroy, contentChild, signal } from '@angular/core';\nimport { NgControl } from '@angular/forms';\nimport { onChange } from 'ng-primitives/utils';\nimport { Subscription } from 'rxjs';\nimport { formFieldState, provideFormFieldState } from './form-field-state';\n\n/**\n * The `NgpFormField` directive is a container for form field elements. Any labels, form controls, or descriptions should be placed within this directive.\n */\n@Directive({\n selector: '[ngpFormField]',\n exportAs: 'ngpFormField',\n providers: [provideFormFieldState()],\n host: {\n '[attr.data-invalid]': 'invalid() ? \"\" : null',\n '[attr.data-valid]': 'valid() ? \"\" : null',\n '[attr.data-touched]': 'touched() ? \"\" : null',\n '[attr.data-pristine]': 'pristine() ? \"\" : null',\n '[attr.data-dirty]': 'dirty() ? \"\" : null',\n '[attr.data-pending]': 'pending() ? \"\" : null',\n '[attr.data-disabled]': 'disabled() ? \"\" : null',\n },\n})\nexport class NgpFormField implements OnDestroy {\n /**\n * Store the form label.\n * @internal\n */\n readonly labels = signal<string[]>([]);\n\n /**\n * Store the form descriptions.\n * @internal\n */\n readonly descriptions = signal<string[]>([]);\n\n /**\n * Store the id of the associated form control.\n * @internal\n */\n readonly formControl = signal<string | null>(null);\n\n /**\n * Find any NgControl within the form field.\n * @internal\n */\n private readonly ngControl = contentChild(NgControl);\n\n /**\n * Store the validation error messages.\n * @internal\n */\n readonly errors = signal<string[]>([]);\n\n /**\n * Whether the control is pristine.\n * @internal\n */\n readonly pristine = signal<boolean | null>(null);\n\n /**\n * Whether the control is touched.\n * @internal\n */\n readonly touched = signal<boolean | null>(null);\n\n /**\n * Whether the control is dirty.\n * @internal\n */\n readonly dirty = signal<boolean | null>(null);\n\n /**\n * Whether the control is valid.\n */\n readonly valid = signal<boolean | null>(null);\n\n /**\n * Whether the control is invalid.\n * @internal\n */\n readonly invalid = signal<boolean | null>(null);\n\n /**\n * Whether the control is pending.\n * @internal\n */\n readonly pending = signal<boolean | null>(null);\n\n /**\n * Whether the control is disabled.\n * @internal\n */\n readonly disabled = signal<boolean | null>(null);\n\n /**\n * Store the current status subscription.\n */\n private subscription?: Subscription;\n\n /**\n * The form field state.\n */\n protected readonly state = formFieldState<NgpFormField>(this);\n\n constructor() {\n // any time the ngControl changes, setup the subscriptions.\n onChange(this.ngControl, this.setupSubscriptions.bind(this));\n }\n\n ngOnDestroy(): void {\n this.subscription?.unsubscribe();\n }\n\n /**\n * Setup a listener for the form control status.\n * @param control\n */\n private setupSubscriptions(control: NgControl | null | undefined): void {\n // Unsubscribe from the previous subscriptions.\n this.subscription?.unsubscribe();\n\n // set the initial values\n this.updateStatus();\n\n // Listen for changes to the form control.\n this.subscription = control?.valueChanges?.subscribe(this.updateStatus.bind(this));\n }\n\n private updateStatus(): void {\n const control = this.ngControl();\n\n if (!control) {\n return;\n }\n\n this.pristine.set(control.pristine);\n this.touched.set(control.touched);\n this.dirty.set(control.dirty);\n this.valid.set(control.valid);\n this.invalid.set(control.invalid);\n this.pending.set(control.pending);\n this.disabled.set(control.disabled);\n this.errors.set(control?.errors ? Object.keys(control.errors) : []);\n }\n\n /**\n * Register the id of the associated form control.\n * @param id\n * @internal\n */\n setFormControl(id: string): void {\n this.formControl.set(id);\n }\n\n /**\n * Register a label with the form field.\n * @param label\n * @internal\n */\n addLabel(label: string): void {\n this.labels.update(labels => [...labels, label]);\n }\n\n /**\n * Register a description with the form field.\n * @param description\n * @internal\n */\n addDescription(description: string): void {\n this.descriptions.update(descriptions => [...descriptions, description]);\n }\n\n /**\n * Remove the associated form control.\n * @internal\n */\n removeFormControl(): void {\n this.formControl.set(null);\n }\n\n /**\n * Remove a label from the form field.\n * @param label\n * @internal\n */\n removeLabel(label: string): void {\n this.labels.update(labels => labels.filter(l => l !== label));\n }\n\n /**\n * Remove a description from the form field.\n * @param description\n * @internal\n */\n removeDescription(description: string): void {\n this.descriptions.update(descriptions => descriptions.filter(d => d !== description));\n }\n}\n","import {\n computed,\n Directive,\n effect,\n ElementRef,\n HostListener,\n inject,\n input,\n} from '@angular/core';\nimport { uniqueId } from 'ng-primitives/utils';\nimport { injectFormFieldState } from '../form-field/form-field-state';\n\n/**\n * The `NgpLabel` directive is used to mark a label element within a form field. Preferably, there should use an HTML `<label>` element.\n */\n@Directive({\n selector: '[ngpLabel]',\n exportAs: 'ngpLabel',\n host: {\n '[attr.id]': 'id()',\n '[attr.for]': 'htmlFor()',\n '[attr.data-invalid]': 'formField()?.invalid() ? \"\" : null',\n '[attr.data-valid]': 'formField()?.valid() ? \"\" : null',\n '[attr.data-touched]': 'formField()?.touched() ? \"\" : null',\n '[attr.data-pristine]': 'formField()?.pristine() ? \"\" : null',\n '[attr.data-dirty]': 'formField()?.dirty() ? \"\" : null',\n '[attr.data-pending]': 'formField()?.pending() ? \"\" : null',\n '[attr.data-disabled]': 'formField()?.disabled() ? \"\" : null',\n },\n})\nexport class NgpLabel {\n /**\n * The id of the label. If not provided, a unique id will be generated.\n */\n readonly id = input<string>(uniqueId('ngp-label'));\n /**\n * Access the form field that the label is associated with.\n */\n protected readonly formField = injectFormFieldState({ optional: true });\n /**\n * Derive the for attribute value if the label is an HTML label element.\n */\n protected readonly htmlFor = computed(() => this.formField()?.formControl());\n /**\n * Access the element that the label is associated with.\n */\n private readonly elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n /**\n * Determine if the label is an HTML label element.\n */\n protected readonly isLabel = this.elementRef.nativeElement instanceof HTMLLabelElement;\n\n constructor() {\n effect(onCleanup => {\n this.formField()?.addLabel(this.id());\n onCleanup(() => this.formField()?.removeLabel(this.id()));\n });\n }\n\n @HostListener('click', ['$event'])\n protected onClick(event: MouseEvent): void {\n // by default a label will perform a click on the associated form control, however\n // this only works if the associated form control is an input element which may not always\n // be the case, so we prevent the default behavior and handle the click event ourselves.\n // This was inspired by the HeadlessUI approach:\n // https://github.com/tailwindlabs/headlessui/blob/main/packages/%40headlessui-react/src/components/label/label.tsx#L58\n if (this.isLabel) {\n event.preventDefault();\n }\n\n // to find the associated form control we can lookup via the known id\n const targetId = this.htmlFor();\n\n if (!targetId) {\n return;\n }\n\n const target = document.getElementById(targetId);\n\n if (!target) {\n return;\n }\n\n // if the target is disabled then do nothing\n const disabled = target.getAttribute('disabled');\n const ariaDisabled = target.getAttribute('aria-disabled');\n\n if (disabled === '' || disabled === 'true' || ariaDisabled === 'true') {\n return;\n }\n\n // radio buttons, checkboxes and switches should all be clicked immediately as they require state changes\n if (\n (target instanceof HTMLInputElement &&\n (target.type === 'radio' || target.type === 'checkbox')) ||\n target.role === 'radio' ||\n target.role === 'checkbox' ||\n target.role === 'switch'\n ) {\n target.click();\n }\n\n // Move focus to the element, this allows you to start using keyboard shortcuts since the\n // bound element is now focused.\n target.focus({ preventScroll: true });\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport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