ng-primitives 0.0.7 → 0.2.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 (211) hide show
  1. package/README.md +14 -4
  2. package/accordion/accordion-trigger/accordion-trigger.directive.d.ts +2 -1
  3. package/autofill/README.md +3 -0
  4. package/autofill/autofill/autofill.directive.d.ts +19 -0
  5. package/{select/select-button/select-button.token.d.ts → autofill/autofill/autofill.token.d.ts} +4 -4
  6. package/autofill/index.d.ts +9 -0
  7. package/avatar/avatar/avatar.directive.d.ts +2 -1
  8. package/button/README.md +3 -0
  9. package/button/button/button.directive.d.ts +27 -0
  10. package/{select/select-option/select-option.token.d.ts → button/button/button.token.d.ts} +4 -4
  11. package/button/index.d.ts +9 -0
  12. package/checkbox/checkbox/checkbox.directive.d.ts +11 -61
  13. package/checkbox/index.d.ts +0 -4
  14. package/esm2022/a11y/visually-hidden/visually-hidden.directive.mjs +3 -3
  15. package/esm2022/accordion/accordion/accordion.directive.mjs +5 -4
  16. package/esm2022/accordion/accordion-content/accordion-content.directive.mjs +5 -6
  17. package/esm2022/accordion/accordion-item/accordion-item.directive.mjs +5 -5
  18. package/esm2022/accordion/accordion-trigger/accordion-trigger.directive.mjs +8 -5
  19. package/esm2022/autofill/autofill/autofill.directive.mjs +71 -0
  20. package/esm2022/autofill/autofill/autofill.token.mjs +16 -0
  21. package/esm2022/autofill/index.mjs +10 -0
  22. package/esm2022/autofill/ng-primitives-autofill.mjs +5 -0
  23. package/esm2022/avatar/avatar/avatar.directive.mjs +7 -4
  24. package/esm2022/avatar/avatar-fallback/avatar-fallback.directive.mjs +3 -3
  25. package/esm2022/avatar/avatar-image/avatar-image.directive.mjs +3 -3
  26. package/esm2022/button/button/button.directive.mjs +47 -0
  27. package/esm2022/button/button/button.token.mjs +16 -0
  28. package/esm2022/button/index.mjs +10 -0
  29. package/esm2022/button/ng-primitives-button.mjs +5 -0
  30. package/esm2022/checkbox/checkbox/checkbox.directive.mjs +29 -79
  31. package/esm2022/checkbox/index.mjs +1 -5
  32. package/esm2022/file-upload/file-upload/file-upload.directive.mjs +7 -4
  33. package/esm2022/focus-trap/focus-trap/focus-trap.directive.mjs +262 -0
  34. package/esm2022/focus-trap/focus-trap/focus-trap.token.mjs +16 -0
  35. package/esm2022/focus-trap/index.mjs +10 -0
  36. package/esm2022/focus-trap/ng-primitives-focus-trap.mjs +5 -0
  37. package/esm2022/form-field/description/description.directive.mjs +14 -14
  38. package/esm2022/form-field/error/error.directive.mjs +27 -29
  39. package/esm2022/form-field/form-control/form-control.directive.mjs +22 -16
  40. package/esm2022/form-field/form-field/form-field.directive.mjs +3 -3
  41. package/esm2022/form-field/form-field/form-field.token.mjs +3 -7
  42. package/esm2022/form-field/label/label.directive.mjs +56 -17
  43. package/esm2022/input/index.mjs +10 -0
  44. package/esm2022/input/input/input.directive.mjs +55 -0
  45. package/esm2022/input/input/input.token.mjs +16 -0
  46. package/esm2022/input/ng-primitives-input.mjs +5 -0
  47. package/esm2022/interactions/focus/focus.directive.mjs +15 -10
  48. package/esm2022/interactions/focus-visible/focus-visible.directive.mjs +12 -7
  49. package/esm2022/interactions/hover/hover.directive.mjs +16 -11
  50. package/esm2022/interactions/index.mjs +5 -1
  51. package/esm2022/interactions/move/move.directive.mjs +216 -0
  52. package/esm2022/interactions/move/move.token.mjs +16 -0
  53. package/esm2022/interactions/press/press.directive.mjs +118 -0
  54. package/esm2022/interactions/press/press.token.mjs +16 -0
  55. package/esm2022/internal/disabled/disabled.mjs +19 -0
  56. package/esm2022/internal/index.mjs +11 -0
  57. package/esm2022/internal/ng-primitives-internal.mjs +5 -0
  58. package/esm2022/internal/orientation/orientation.mjs +19 -0
  59. package/esm2022/internal/style-injector/style-injector.mjs +81 -0
  60. package/esm2022/progress/progress/progress.directive.mjs +3 -3
  61. package/esm2022/progress/progress-indicator/progress-indicator.directive.mjs +3 -3
  62. package/esm2022/radio/radio-group/radio-group.directive.mjs +14 -54
  63. package/esm2022/radio/radio-indicator/radio-indicator.directive.mjs +8 -5
  64. package/esm2022/radio/radio-item/radio-item.directive.mjs +8 -6
  65. package/esm2022/resize/resize/resize.directive.mjs +3 -3
  66. package/esm2022/roving-focus/roving-focus-group/roving-focus-group.directive.mjs +14 -9
  67. package/esm2022/roving-focus/roving-focus-item/roving-focus-item.directive.mjs +3 -3
  68. package/esm2022/search/index.mjs +10 -0
  69. package/esm2022/search/ng-primitives-search.mjs +5 -0
  70. package/esm2022/search/search-field/search-field.directive.mjs +47 -0
  71. package/esm2022/search/search-field/search-field.token.mjs +16 -0
  72. package/esm2022/select/index.mjs +1 -7
  73. package/esm2022/select/select/select.directive.mjs +23 -36
  74. package/esm2022/select/select/select.token.mjs +1 -1
  75. package/esm2022/slider/slider/slider.directive.mjs +18 -5
  76. package/esm2022/slider/slider-range/slider-range.directive.mjs +6 -5
  77. package/esm2022/slider/slider-thumb/slider-thumb.directive.mjs +7 -4
  78. package/esm2022/slider/slider-track/slider-track.directive.mjs +8 -4
  79. package/esm2022/switch/switch/switch.directive.mjs +18 -58
  80. package/esm2022/switch/switch-thumb/switch-thumb.directive.mjs +9 -6
  81. package/esm2022/tabs/tab-button/tab-button.directive.mjs +8 -6
  82. package/esm2022/tabs/tab-list/tab-list.directive.mjs +3 -3
  83. package/esm2022/tabs/tab-panel/tab-panel.directive.mjs +5 -6
  84. package/esm2022/tabs/tabset/tabset.directive.mjs +14 -18
  85. package/esm2022/textarea/index.mjs +10 -0
  86. package/esm2022/textarea/ng-primitives-textarea.mjs +5 -0
  87. package/esm2022/textarea/textarea/textarea.directive.mjs +37 -0
  88. package/esm2022/textarea/textarea/textarea.token.mjs +16 -0
  89. package/esm2022/toggle/toggle/toggle.directive.mjs +33 -13
  90. package/esm2022/tooltip/tooltip/tooltip.directive.mjs +3 -3
  91. package/esm2022/tooltip/tooltip-trigger/tooltip-trigger.directive.mjs +7 -7
  92. package/esm2022/utils/helpers/focus-manager.mjs +3 -3
  93. package/esm2022/utils/index.mjs +2 -2
  94. package/esm2022/utils/signals/async.mjs +11 -17
  95. package/fesm2022/ng-primitives-a11y.mjs +3 -3
  96. package/fesm2022/ng-primitives-accordion.mjs +19 -16
  97. package/fesm2022/ng-primitives-accordion.mjs.map +1 -1
  98. package/fesm2022/ng-primitives-autofill.mjs +100 -0
  99. package/fesm2022/ng-primitives-autofill.mjs.map +1 -0
  100. package/fesm2022/ng-primitives-avatar.mjs +13 -10
  101. package/fesm2022/ng-primitives-avatar.mjs.map +1 -1
  102. package/fesm2022/ng-primitives-button.mjs +76 -0
  103. package/fesm2022/ng-primitives-button.mjs.map +1 -0
  104. package/fesm2022/ng-primitives-checkbox.mjs +25 -203
  105. package/fesm2022/ng-primitives-checkbox.mjs.map +1 -1
  106. package/fesm2022/ng-primitives-file-upload.mjs +6 -3
  107. package/fesm2022/ng-primitives-file-upload.mjs.map +1 -1
  108. package/fesm2022/ng-primitives-focus-trap.mjs +291 -0
  109. package/fesm2022/ng-primitives-focus-trap.mjs.map +1 -0
  110. package/fesm2022/ng-primitives-form-field.mjs +119 -80
  111. package/fesm2022/ng-primitives-form-field.mjs.map +1 -1
  112. package/fesm2022/ng-primitives-input.mjs +84 -0
  113. package/fesm2022/ng-primitives-input.mjs.map +1 -0
  114. package/fesm2022/ng-primitives-interactions.mjs +394 -26
  115. package/fesm2022/ng-primitives-interactions.mjs.map +1 -1
  116. package/fesm2022/ng-primitives-internal.mjs +132 -0
  117. package/fesm2022/ng-primitives-internal.mjs.map +1 -0
  118. package/fesm2022/ng-primitives-progress.mjs +6 -6
  119. package/fesm2022/ng-primitives-radio.mjs +25 -62
  120. package/fesm2022/ng-primitives-radio.mjs.map +1 -1
  121. package/fesm2022/ng-primitives-resize.mjs +3 -3
  122. package/fesm2022/ng-primitives-roving-focus.mjs +15 -10
  123. package/fesm2022/ng-primitives-roving-focus.mjs.map +1 -1
  124. package/fesm2022/ng-primitives-search.mjs +76 -0
  125. package/fesm2022/ng-primitives-search.mjs.map +1 -0
  126. package/fesm2022/ng-primitives-select.mjs +23 -395
  127. package/fesm2022/ng-primitives-select.mjs.map +1 -1
  128. package/fesm2022/ng-primitives-slider.mjs +35 -14
  129. package/fesm2022/ng-primitives-slider.mjs.map +1 -1
  130. package/fesm2022/ng-primitives-switch.mjs +23 -62
  131. package/fesm2022/ng-primitives-switch.mjs.map +1 -1
  132. package/fesm2022/ng-primitives-tabs.mjs +27 -30
  133. package/fesm2022/ng-primitives-tabs.mjs.map +1 -1
  134. package/fesm2022/ng-primitives-textarea.mjs +66 -0
  135. package/fesm2022/ng-primitives-textarea.mjs.map +1 -0
  136. package/fesm2022/ng-primitives-toggle.mjs +32 -12
  137. package/fesm2022/ng-primitives-toggle.mjs.map +1 -1
  138. package/fesm2022/ng-primitives-tooltip.mjs +9 -9
  139. package/fesm2022/ng-primitives-tooltip.mjs.map +1 -1
  140. package/fesm2022/ng-primitives-utils.mjs +14 -20
  141. package/fesm2022/ng-primitives-utils.mjs.map +1 -1
  142. package/file-upload/file-upload/file-upload.directive.d.ts +2 -1
  143. package/focus-trap/README.md +3 -0
  144. package/focus-trap/focus-trap/focus-trap.directive.d.ts +64 -0
  145. package/{select/select-options/select-options.token.d.ts → focus-trap/focus-trap/focus-trap.token.d.ts} +4 -4
  146. package/focus-trap/index.d.ts +9 -0
  147. package/form-field/description/description.directive.d.ts +1 -1
  148. package/form-field/error/error.directive.d.ts +9 -5
  149. package/form-field/form-control/form-control.directive.d.ts +7 -3
  150. package/form-field/form-field/form-field.token.d.ts +1 -1
  151. package/form-field/label/label.directive.d.ts +3 -2
  152. package/input/README.md +3 -0
  153. package/input/index.d.ts +9 -0
  154. package/input/input/input.directive.d.ts +33 -0
  155. package/input/input/input.token.d.ts +14 -0
  156. package/interactions/focus/focus.directive.d.ts +6 -2
  157. package/interactions/focus-visible/focus-visible.directive.d.ts +5 -1
  158. package/interactions/hover/hover.directive.d.ts +5 -1
  159. package/interactions/index.d.ts +4 -0
  160. package/interactions/move/move.directive.d.ts +126 -0
  161. package/interactions/move/move.token.d.ts +14 -0
  162. package/interactions/press/press.directive.d.ts +59 -0
  163. package/interactions/press/press.token.d.ts +14 -0
  164. package/internal/README.md +3 -0
  165. package/internal/disabled/disabled.d.ts +21 -0
  166. package/internal/index.d.ts +10 -0
  167. package/internal/orientation/orientation.d.ts +22 -0
  168. package/internal/style-injector/style-injector.d.ts +36 -0
  169. package/package.json +49 -7
  170. package/radio/radio-group/radio-group.directive.d.ts +4 -41
  171. package/radio/radio-indicator/radio-indicator.directive.d.ts +2 -1
  172. package/radio/radio-item/radio-item.directive.d.ts +2 -1
  173. package/roving-focus/roving-focus-group/roving-focus-group.directive.d.ts +7 -2
  174. package/search/README.md +3 -0
  175. package/search/index.d.ts +9 -0
  176. package/search/search-field/search-field.directive.d.ts +15 -0
  177. package/search/search-field/search-field.token.d.ts +14 -0
  178. package/select/index.d.ts +0 -6
  179. package/select/select/select.directive.d.ts +7 -22
  180. package/select/select/select.token.d.ts +2 -2
  181. package/slider/slider/slider.directive.d.ts +4 -2
  182. package/slider/slider-thumb/slider-thumb.directive.d.ts +2 -1
  183. package/slider/slider-track/slider-track.directive.d.ts +1 -1
  184. package/switch/switch/switch.directive.d.ts +5 -45
  185. package/switch/switch-thumb/switch-thumb.directive.d.ts +2 -1
  186. package/tabs/tab-button/tab-button.directive.d.ts +2 -1
  187. package/tabs/tabset/tabset.directive.d.ts +3 -9
  188. package/textarea/README.md +3 -0
  189. package/textarea/index.d.ts +9 -0
  190. package/textarea/textarea/textarea.directive.d.ts +20 -0
  191. package/textarea/textarea/textarea.token.d.ts +14 -0
  192. package/toggle/toggle/toggle.directive.d.ts +16 -4
  193. package/utils/index.d.ts +1 -1
  194. package/utils/signals/async.d.ts +10 -12
  195. package/checkbox/checkbox-indicator/checkbox-indicator.directive.d.ts +0 -19
  196. package/checkbox/checkbox-indicator/checkbox-indicator.token.d.ts +0 -15
  197. package/checkbox/checkbox-input/checkbox-input.directive.d.ts +0 -10
  198. package/checkbox/checkbox-label/checkbox-label.directive.d.ts +0 -9
  199. package/esm2022/checkbox/checkbox-indicator/checkbox-indicator.directive.mjs +0 -51
  200. package/esm2022/checkbox/checkbox-indicator/checkbox-indicator.token.mjs +0 -17
  201. package/esm2022/checkbox/checkbox-input/checkbox-input.directive.mjs +0 -40
  202. package/esm2022/checkbox/checkbox-label/checkbox-label.directive.mjs +0 -32
  203. package/esm2022/select/select-button/select-button.directive.mjs +0 -84
  204. package/esm2022/select/select-button/select-button.token.mjs +0 -16
  205. package/esm2022/select/select-option/select-option.directive.mjs +0 -90
  206. package/esm2022/select/select-option/select-option.token.mjs +0 -16
  207. package/esm2022/select/select-options/select-options.directive.mjs +0 -157
  208. package/esm2022/select/select-options/select-options.token.mjs +0 -16
  209. package/select/select-button/select-button.directive.d.ts +0 -51
  210. package/select/select-option/select-option.directive.d.ts +0 -57
  211. package/select/select-options/select-options.directive.d.ts +0 -65
@@ -1,7 +1,8 @@
1
1
  import * as i0 from '@angular/core';
2
- import { InjectionToken, inject, signal, contentChild, Directive, ElementRef, input, computed, effect } from '@angular/core';
2
+ import { InjectionToken, inject, signal, contentChild, Directive, ElementRef, input, computed, effect, HostListener } from '@angular/core';
3
3
  import { NgControl } from '@angular/forms';
4
- import { onChange, uniqueId } from 'ng-primitives/utils';
4
+ import { onChange, uniqueId, onBooleanChange } from 'ng-primitives/utils';
5
+ import { injectDisabled } from 'ng-primitives/internal';
5
6
 
6
7
  /**
7
8
  * Copyright © 2024 Angular Primitives.
@@ -15,12 +16,8 @@ const NgpFormFieldToken = new InjectionToken('NgpFormFieldToken');
15
16
  * Inject the FormField directive instance
16
17
  * @param primitive
17
18
  */
18
- function injectFormField(primitive) {
19
- const formField = inject(NgpFormFieldToken, { optional: true });
20
- if (!formField) {
21
- throw new Error(`The ${primitive} directive must be used within an NgpFormField.`);
22
- }
23
- return formField;
19
+ function injectFormField() {
20
+ return inject(NgpFormFieldToken, { optional: true });
24
21
  }
25
22
 
26
23
  /**
@@ -170,10 +167,10 @@ class NgpFormField {
170
167
  removeDescription(description) {
171
168
  this.descriptions.update(descriptions => descriptions.filter(d => d !== description));
172
169
  }
173
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.2", ngImport: i0, type: NgpFormField, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
174
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "18.0.2", type: NgpFormField, isStandalone: true, selector: "[ngpFormField]", host: { properties: { "attr.data-invalid": "invalid()", "attr.data-valid": "valid()", "attr.data-touched": "touched()", "attr.data-pristine": "pristine()", "attr.data-dirty": "dirty()", "attr.data-pending": "pending()", "attr.data-disabled": "disabled()" } }, providers: [{ provide: NgpFormFieldToken, useExisting: NgpFormField }], queries: [{ propertyName: "ngControl", first: true, predicate: NgControl, descendants: true, isSignal: true }], exportAs: ["ngpFormField"], ngImport: i0 }); }
170
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: NgpFormField, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
171
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "18.1.1", type: NgpFormField, isStandalone: true, selector: "[ngpFormField]", host: { properties: { "attr.data-invalid": "invalid()", "attr.data-valid": "valid()", "attr.data-touched": "touched()", "attr.data-pristine": "pristine()", "attr.data-dirty": "dirty()", "attr.data-pending": "pending()", "attr.data-disabled": "disabled()" } }, providers: [{ provide: NgpFormFieldToken, useExisting: NgpFormField }], queries: [{ propertyName: "ngControl", first: true, predicate: NgControl, descendants: true, isSignal: true }], exportAs: ["ngpFormField"], ngImport: i0 }); }
175
172
  }
176
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.2", ngImport: i0, type: NgpFormField, decorators: [{
173
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: NgpFormField, decorators: [{
177
174
  type: Directive,
178
175
  args: [{
179
176
  standalone: true,
@@ -223,7 +220,7 @@ class NgpLabel {
223
220
  /**
224
221
  * Access the form field that the label is associated with.
225
222
  */
226
- this.formField = injectFormField('NgpLabel');
223
+ this.formField = injectFormField();
227
224
  /**
228
225
  * The id of the label. If not provided, a unique id will be generated.
229
226
  */
@@ -235,16 +232,52 @@ class NgpLabel {
235
232
  /**
236
233
  * Derive the for attribute value if the label is an HTML label element.
237
234
  */
238
- this.htmlFor = computed(() => (this.isLabel ? this.formField.formControl() : null));
235
+ this.htmlFor = computed(() => this.formField?.formControl());
239
236
  effect(onCleanup => {
240
- this.formField.addLabel(this.id());
241
- onCleanup(() => this.formField.removeLabel(this.id()));
237
+ this.formField?.addLabel(this.id());
238
+ onCleanup(() => this.formField?.removeLabel(this.id()));
242
239
  }, { allowSignalWrites: true });
243
240
  }
244
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.2", ngImport: i0, type: NgpLabel, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
245
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "18.0.2", type: NgpLabel, isStandalone: true, selector: "[ngpLabel]", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "attr.id": "id()", "attr.for": "htmlFor()", "attr.data-invalid": "formField.invalid()", "attr.data-valid": "formField.valid()", "attr.data-touched": "formField.touched()", "attr.data-pristine": "formField.pristine()", "attr.data-dirty": "formField.dirty()", "attr.data-pending": "formField.pending()", "attr.data-disabled": "formField.disabled()" } }, providers: [{ provide: NgpLabelToken, useExisting: NgpLabel }], exportAs: ["ngpLabel"], ngImport: i0 }); }
241
+ onClick(event) {
242
+ // by default a label will perform a click on the associated form control, however
243
+ // this only works if the associated form control is an input element which may not always
244
+ // be the case, so we prevent the default behavior and handle the click event ourselves.
245
+ // This was inspired by the HeadlessUI approach:
246
+ // https://github.com/tailwindlabs/headlessui/blob/main/packages/%40headlessui-react/src/components/label/label.tsx#L58
247
+ if (this.isLabel) {
248
+ event.preventDefault();
249
+ }
250
+ // to find the associated form control we can lookup via the known id
251
+ const targetId = this.htmlFor();
252
+ if (!targetId) {
253
+ return;
254
+ }
255
+ const target = document.getElementById(targetId);
256
+ if (!target) {
257
+ return;
258
+ }
259
+ // if the target is disabled then do nothing
260
+ const disabled = target.getAttribute('disabled');
261
+ const ariaDisabled = target.getAttribute('aria-disabled');
262
+ if (disabled === '' || disabled === 'true' || ariaDisabled === 'true') {
263
+ return;
264
+ }
265
+ // radio buttons, checkboxes and switches should all be clicked immediately as they require state changes
266
+ if ((target instanceof HTMLInputElement &&
267
+ (target.type === 'radio' || target.type === 'checkbox')) ||
268
+ target.role === 'radio' ||
269
+ target.role === 'checkbox' ||
270
+ target.role === 'switch') {
271
+ target.click();
272
+ }
273
+ // Move focus to the element, this allows you to start using keyboard shortcuts since the
274
+ // bound element is now focused.
275
+ target.focus({ preventScroll: true });
276
+ }
277
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: NgpLabel, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
278
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "18.1.1", 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()", "attr.data-valid": "formField?.valid()", "attr.data-touched": "formField?.touched()", "attr.data-pristine": "formField?.pristine()", "attr.data-dirty": "formField?.dirty()", "attr.data-pending": "formField?.pending()", "attr.data-disabled": "formField?.disabled()" } }, providers: [{ provide: NgpLabelToken, useExisting: NgpLabel }], exportAs: ["ngpLabel"], ngImport: i0 }); }
246
279
  }
247
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.2", ngImport: i0, type: NgpLabel, decorators: [{
280
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: NgpLabel, decorators: [{
248
281
  type: Directive,
249
282
  args: [{
250
283
  standalone: true,
@@ -254,16 +287,19 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.2", ngImpor
254
287
  host: {
255
288
  '[attr.id]': 'id()',
256
289
  '[attr.for]': 'htmlFor()',
257
- '[attr.data-invalid]': 'formField.invalid()',
258
- '[attr.data-valid]': 'formField.valid()',
259
- '[attr.data-touched]': 'formField.touched()',
260
- '[attr.data-pristine]': 'formField.pristine()',
261
- '[attr.data-dirty]': 'formField.dirty()',
262
- '[attr.data-pending]': 'formField.pending()',
263
- '[attr.data-disabled]': 'formField.disabled()',
290
+ '[attr.data-invalid]': 'formField?.invalid()',
291
+ '[attr.data-valid]': 'formField?.valid()',
292
+ '[attr.data-touched]': 'formField?.touched()',
293
+ '[attr.data-pristine]': 'formField?.pristine()',
294
+ '[attr.data-dirty]': 'formField?.dirty()',
295
+ '[attr.data-pending]': 'formField?.pending()',
296
+ '[attr.data-disabled]': 'formField?.disabled()',
264
297
  },
265
298
  }]
266
- }], ctorParameters: () => [] });
299
+ }], ctorParameters: () => [], propDecorators: { onClick: [{
300
+ type: HostListener,
301
+ args: ['click', ['$event']]
302
+ }] } });
267
303
 
268
304
  /**
269
305
  * Copyright © 2024 Angular Primitives.
@@ -292,20 +328,20 @@ class NgpDescription {
292
328
  /**
293
329
  * Access the form field that the description is associated with.
294
330
  */
295
- this.formField = injectFormField('NgpDescription');
331
+ this.formField = injectFormField();
296
332
  /**
297
333
  * The id of the description. If not provided, a unique id will be generated.
298
334
  */
299
335
  this.id = input(uniqueId('ngp-description'));
300
336
  effect(onCleanup => {
301
- this.formField.addDescription(this.id());
302
- onCleanup(() => this.formField.removeDescription(this.id()));
337
+ this.formField?.addDescription(this.id());
338
+ onCleanup(() => this.formField?.removeDescription(this.id()));
303
339
  }, { allowSignalWrites: true });
304
340
  }
305
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.2", ngImport: i0, type: NgpDescription, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
306
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "18.0.2", 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()", "attr.data-valid": "formField.valid()", "attr.data-touched": "formField.touched()", "attr.data-pristine": "formField.pristine()", "attr.data-dirty": "formField.dirty()", "attr.data-pending": "formField.pending()", "attr.data-disabled": "formField.disabled()" } }, providers: [{ provide: NgpDescriptionToken, useExisting: NgpDescription }], exportAs: ["ngpDescription"], ngImport: i0 }); }
341
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: NgpDescription, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
342
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "18.1.1", 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()", "attr.data-valid": "formField?.valid()", "attr.data-touched": "formField?.touched()", "attr.data-pristine": "formField?.pristine()", "attr.data-dirty": "formField?.dirty()", "attr.data-pending": "formField?.pending()", "attr.data-disabled": "formField?.disabled()" } }, providers: [{ provide: NgpDescriptionToken, useExisting: NgpDescription }], exportAs: ["ngpDescription"], ngImport: i0 }); }
307
343
  }
308
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.2", ngImport: i0, type: NgpDescription, decorators: [{
344
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: NgpDescription, decorators: [{
309
345
  type: Directive,
310
346
  args: [{
311
347
  standalone: true,
@@ -314,13 +350,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.2", ngImpor
314
350
  providers: [{ provide: NgpDescriptionToken, useExisting: NgpDescription }],
315
351
  host: {
316
352
  '[attr.id]': 'id()',
317
- '[attr.data-invalid]': 'formField.invalid()',
318
- '[attr.data-valid]': 'formField.valid()',
319
- '[attr.data-touched]': 'formField.touched()',
320
- '[attr.data-pristine]': 'formField.pristine()',
321
- '[attr.data-dirty]': 'formField.dirty()',
322
- '[attr.data-pending]': 'formField.pending()',
323
- '[attr.data-disabled]': 'formField.disabled()',
353
+ '[attr.data-invalid]': 'formField?.invalid()',
354
+ '[attr.data-valid]': 'formField?.valid()',
355
+ '[attr.data-touched]': 'formField?.touched()',
356
+ '[attr.data-pristine]': 'formField?.pristine()',
357
+ '[attr.data-dirty]': 'formField?.dirty()',
358
+ '[attr.data-pending]': 'formField?.pending()',
359
+ '[attr.data-disabled]': 'formField?.disabled()',
324
360
  },
325
361
  }]
326
362
  }], ctorParameters: () => [] });
@@ -352,7 +388,11 @@ class NgpFormControl {
352
388
  /**
353
389
  * Access the form field that the form control is associated with.
354
390
  */
355
- this.formField = injectFormField('NgpFormControl');
391
+ this.formField = injectFormField();
392
+ /**
393
+ * Whether the form control is disabled by a parent.
394
+ */
395
+ this.disabled = injectDisabled();
356
396
  /**
357
397
  * The id of the form control. If not provided, a unique id will be generated.
358
398
  */
@@ -360,20 +400,20 @@ class NgpFormControl {
360
400
  /**
361
401
  * Determine the aria-labelledby attribute value.
362
402
  */
363
- this.ariaLabelledBy = computed(() => this.formField.labels().join(' '));
403
+ this.ariaLabelledBy = computed(() => this.formField?.labels().join(' '));
364
404
  /**
365
405
  * Determine the aria-describedby attribute value.
366
406
  */
367
- this.ariaDescribedBy = computed(() => this.formField.descriptions().join(' '));
407
+ this.ariaDescribedBy = computed(() => this.formField?.descriptions().join(' '));
368
408
  effect(onCleanup => {
369
- this.formField.setFormControl(this.id());
370
- onCleanup(() => this.formField.removeFormControl());
409
+ this.formField?.setFormControl(this.id());
410
+ onCleanup(() => this.formField?.removeFormControl());
371
411
  }, { allowSignalWrites: true });
372
412
  }
373
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.2", ngImport: i0, type: NgpFormControl, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
374
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "18.0.2", type: NgpFormControl, isStandalone: true, selector: "[ngpFormControl]", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "attr.aria-labelledby": "ariaLabelledBy()", "attr.aria-describedby": "ariaDescribedBy()", "attr.data-invalid": "formField.invalid()", "attr.data-valid": "formField.valid()", "attr.data-touched": "formField.touched()", "attr.data-pristine": "formField.pristine()", "attr.data-dirty": "formField.dirty()", "attr.data-pending": "formField.pending()", "attr.data-disabled": "formField.disabled()" } }, providers: [{ provide: NgpFormControlToken, useExisting: NgpFormControl }], exportAs: ["ngpFormControl"], ngImport: i0 }); }
413
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: NgpFormControl, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
414
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "18.1.1", 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()", "attr.data-valid": "formField?.valid()", "attr.data-touched": "formField?.touched()", "attr.data-pristine": "formField?.pristine()", "attr.data-dirty": "formField?.dirty()", "attr.data-pending": "formField?.pending()", "attr.data-disabled": "formField?.disabled() || disabled()" } }, providers: [{ provide: NgpFormControlToken, useExisting: NgpFormControl }], exportAs: ["ngpFormControl"], ngImport: i0 }); }
375
415
  }
376
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.2", ngImport: i0, type: NgpFormControl, decorators: [{
416
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: NgpFormControl, decorators: [{
377
417
  type: Directive,
378
418
  args: [{
379
419
  standalone: true,
@@ -381,15 +421,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.2", ngImpor
381
421
  exportAs: 'ngpFormControl',
382
422
  providers: [{ provide: NgpFormControlToken, useExisting: NgpFormControl }],
383
423
  host: {
424
+ '[id]': 'id()',
384
425
  '[attr.aria-labelledby]': 'ariaLabelledBy()',
385
426
  '[attr.aria-describedby]': 'ariaDescribedBy()',
386
- '[attr.data-invalid]': 'formField.invalid()',
387
- '[attr.data-valid]': 'formField.valid()',
388
- '[attr.data-touched]': 'formField.touched()',
389
- '[attr.data-pristine]': 'formField.pristine()',
390
- '[attr.data-dirty]': 'formField.dirty()',
391
- '[attr.data-pending]': 'formField.pending()',
392
- '[attr.data-disabled]': 'formField.disabled()',
427
+ '[attr.data-invalid]': 'formField?.invalid()',
428
+ '[attr.data-valid]': 'formField?.valid()',
429
+ '[attr.data-touched]': 'formField?.touched()',
430
+ '[attr.data-pristine]': 'formField?.pristine()',
431
+ '[attr.data-dirty]': 'formField?.dirty()',
432
+ '[attr.data-pending]': 'formField?.pending()',
433
+ '[attr.data-disabled]': 'formField?.disabled() || disabled()',
393
434
  },
394
435
  }]
395
436
  }], ctorParameters: () => [] });
@@ -421,7 +462,7 @@ class NgpError {
421
462
  /**
422
463
  * Access the form field that the description is associated with.
423
464
  */
424
- this.formField = injectFormField('NgpError');
465
+ this.formField = injectFormField();
425
466
  /**
426
467
  * The id of the error message. If not provided, a unique id will be generated.
427
468
  */
@@ -433,34 +474,32 @@ class NgpError {
433
474
  alias: 'ngpErrorValidator',
434
475
  });
435
476
  /**
436
- * Determine whether the validator associated with this error is failing.
477
+ * Determine if there is an error message.
437
478
  */
438
- this.state = computed(() => {
439
- const errors = this.formField.errors();
479
+ this.hasError = computed(() => {
480
+ const errors = this.formField?.errors() ?? [];
440
481
  const validator = this.validator();
441
- // if there is no validator, then we mark as invalid when the control is invalid.
442
- if (!validator) {
443
- return null;
444
- }
445
- return validator && errors.includes(validator) ? 'fail' : 'pass';
482
+ return validator ? errors?.includes(validator) : errors?.length > 0;
446
483
  });
447
- }
448
- ngOnInit() {
449
- this.formField.addDescription(this.id());
484
+ /**
485
+ * Determine whether the validator associated with this error is failing.
486
+ */
487
+ this.state = computed(() => (this.hasError() ? 'fail' : 'pass'));
488
+ // add or remove the error message when the error state changes
489
+ onBooleanChange(this.hasError, () => this.formField?.addDescription(this.id()), () => this.formField?.removeDescription(this.id()));
450
490
  }
451
491
  ngOnChanges(changes) {
452
492
  if ('id' in changes) {
453
- this.formField.removeDescription(changes['id'].previousValue);
454
- this.formField.addDescription(changes['id'].currentValue);
493
+ this.formField?.removeDescription(changes['id'].previousValue);
455
494
  }
456
495
  }
457
496
  ngOnDestroy() {
458
- this.formField.removeDescription(this.id());
497
+ this.formField?.removeDescription(this.id());
459
498
  }
460
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.2", ngImport: i0, type: NgpError, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
461
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "18.0.2", 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()", "attr.data-valid": "formField.valid()", "attr.data-touched": "formField.touched()", "attr.data-pristine": "formField.pristine()", "attr.data-dirty": "formField.dirty()", "attr.data-pending": "formField.pending()", "attr.data-disabled": "formField.disabled()", "attr.data-validator": "state()" } }, providers: [{ provide: NgpErrorToken, useExisting: NgpError }], exportAs: ["ngpError"], usesOnChanges: true, ngImport: i0 }); }
499
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: NgpError, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
500
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "18.1.1", 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()", "attr.data-valid": "formField?.valid()", "attr.data-touched": "formField?.touched()", "attr.data-pristine": "formField?.pristine()", "attr.data-dirty": "formField?.dirty()", "attr.data-pending": "formField?.pending()", "attr.data-disabled": "formField?.disabled()", "attr.data-validator": "state()" } }, providers: [{ provide: NgpErrorToken, useExisting: NgpError }], exportAs: ["ngpError"], usesOnChanges: true, ngImport: i0 }); }
462
501
  }
463
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.2", ngImport: i0, type: NgpError, decorators: [{
502
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: NgpError, decorators: [{
464
503
  type: Directive,
465
504
  args: [{
466
505
  standalone: true,
@@ -469,17 +508,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.2", ngImpor
469
508
  providers: [{ provide: NgpErrorToken, useExisting: NgpError }],
470
509
  host: {
471
510
  '[attr.id]': 'id()',
472
- '[attr.data-invalid]': 'formField.invalid()',
473
- '[attr.data-valid]': 'formField.valid()',
474
- '[attr.data-touched]': 'formField.touched()',
475
- '[attr.data-pristine]': 'formField.pristine()',
476
- '[attr.data-dirty]': 'formField.dirty()',
477
- '[attr.data-pending]': 'formField.pending()',
478
- '[attr.data-disabled]': 'formField.disabled()',
511
+ '[attr.data-invalid]': 'formField?.invalid()',
512
+ '[attr.data-valid]': 'formField?.valid()',
513
+ '[attr.data-touched]': 'formField?.touched()',
514
+ '[attr.data-pristine]': 'formField?.pristine()',
515
+ '[attr.data-dirty]': 'formField?.dirty()',
516
+ '[attr.data-pending]': 'formField?.pending()',
517
+ '[attr.data-disabled]': 'formField?.disabled()',
479
518
  '[attr.data-validator]': 'state()',
480
519
  },
481
520
  }]
482
- }] });
521
+ }], ctorParameters: () => [] });
483
522
 
484
523
  /**
485
524
  * Copyright © 2024 Angular Primitives.
@@ -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/form-field/form-field.directive.ts","../../../../packages/ng-primitives/form-field/src/label/label.token.ts","../../../../packages/ng-primitives/form-field/src/label/label.directive.ts","../../../../packages/ng-primitives/form-field/src/description/description.token.ts","../../../../packages/ng-primitives/form-field/src/description/description.directive.ts","../../../../packages/ng-primitives/form-field/src/form-control/form-control.token.ts","../../../../packages/ng-primitives/form-field/src/form-control/form-control.directive.ts","../../../../packages/ng-primitives/form-field/src/error/error.token.ts","../../../../packages/ng-primitives/form-field/src/error/error.directive.ts","../../../../packages/ng-primitives/form-field/src/index.ts","../../../../packages/ng-primitives/form-field/src/ng-primitives-form-field.ts"],"sourcesContent":["/**\n * Copyright © 2024 Angular Primitives.\n * https://github.com/ng-primitives/ng-primitives\n *\n * This source code is licensed under the CC BY-ND 4.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { InjectionToken, inject } from '@angular/core';\nimport type { NgpFormField } from './form-field.directive';\n\nexport const NgpFormFieldToken = new InjectionToken<NgpFormField>('NgpFormFieldToken');\n\n/**\n * Inject the FormField directive instance\n * @param primitive\n */\nexport function injectFormField(primitive: string): NgpFormField {\n const formField = inject(NgpFormFieldToken, { optional: true });\n\n if (!formField) {\n throw new Error(`The ${primitive} directive must be used within an NgpFormField.`);\n }\n\n return formField;\n}\n","/**\n * Copyright © 2024 Angular Primitives.\n * https://github.com/ng-primitives/ng-primitives\n *\n * This source code is licensed under the CC BY-ND 4.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { 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@Directive({\n standalone: true,\n selector: '[ngpFormField]',\n exportAs: 'ngpFormField',\n providers: [{ provide: NgpFormFieldToken, useExisting: NgpFormField }],\n host: {\n '[attr.data-invalid]': 'invalid()',\n '[attr.data-valid]': 'valid()',\n '[attr.data-touched]': 'touched()',\n '[attr.data-pristine]': 'pristine()',\n '[attr.data-dirty]': 'dirty()',\n '[attr.data-pending]': 'pending()',\n '[attr.data-disabled]': 'disabled()',\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","/**\n * Copyright © 2024 Angular Primitives.\n * https://github.com/ng-primitives/ng-primitives\n *\n * This source code is licensed under the CC BY-ND 4.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { InjectionToken, inject } from '@angular/core';\nimport type { NgpLabel } from './label.directive';\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","/**\n * Copyright © 2024 Angular Primitives.\n * https://github.com/ng-primitives/ng-primitives\n *\n * This source code is licensed under the CC BY-ND 4.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { Directive, ElementRef, computed, effect, inject, input } from '@angular/core';\nimport { uniqueId } from 'ng-primitives/utils';\nimport { injectFormField } from '../form-field/form-field.token';\nimport { NgpLabelToken } from './label.token';\n\n@Directive({\n standalone: true,\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()',\n '[attr.data-valid]': 'formField.valid()',\n '[attr.data-touched]': 'formField.touched()',\n '[attr.data-pristine]': 'formField.pristine()',\n '[attr.data-dirty]': 'formField.dirty()',\n '[attr.data-pending]': 'formField.pending()',\n '[attr.data-disabled]': 'formField.disabled()',\n },\n})\nexport class NgpLabel {\n /**\n * Access the element that the label is associated with.\n */\n private readonly elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n\n /**\n * Access the form field that the label is associated with.\n */\n protected readonly formField = injectFormField('NgpLabel');\n\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 /**\n * Determine if the label is an HTML label element.\n */\n protected readonly isLabel = this.elementRef.nativeElement instanceof HTMLLabelElement;\n\n /**\n * Derive the for attribute value if the label is an HTML label element.\n */\n protected readonly htmlFor = computed(() => (this.isLabel ? this.formField.formControl() : null));\n\n constructor() {\n effect(\n onCleanup => {\n this.formField.addLabel(this.id());\n onCleanup(() => this.formField.removeLabel(this.id()));\n },\n { allowSignalWrites: true },\n );\n }\n}\n","/**\n * Copyright © 2024 Angular Primitives.\n * https://github.com/ng-primitives/ng-primitives\n *\n * This source code is licensed under the CC BY-ND 4.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { InjectionToken, inject } from '@angular/core';\nimport type { NgpDescription } from './description.directive';\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","/**\n * Copyright © 2024 Angular Primitives.\n * https://github.com/ng-primitives/ng-primitives\n *\n * This source code is licensed under the CC BY-ND 4.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { 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@Directive({\n standalone: true,\n selector: '[ngpDescription]',\n exportAs: 'ngpDescription',\n providers: [{ provide: NgpDescriptionToken, useExisting: NgpDescription }],\n host: {\n '[attr.id]': 'id()',\n '[attr.data-invalid]': 'formField.invalid()',\n '[attr.data-valid]': 'formField.valid()',\n '[attr.data-touched]': 'formField.touched()',\n '[attr.data-pristine]': 'formField.pristine()',\n '[attr.data-dirty]': 'formField.dirty()',\n '[attr.data-pending]': 'formField.pending()',\n '[attr.data-disabled]': 'formField.disabled()',\n },\n})\nexport class NgpDescription {\n /**\n * Access the form field that the description is associated with.\n */\n protected readonly formField = injectFormField('NgpDescription');\n\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 constructor() {\n effect(\n onCleanup => {\n this.formField.addDescription(this.id());\n onCleanup(() => this.formField.removeDescription(this.id()));\n },\n { allowSignalWrites: true },\n );\n }\n}\n","/**\n * Copyright © 2024 Angular Primitives.\n * https://github.com/ng-primitives/ng-primitives\n *\n * This source code is licensed under the CC BY-ND 4.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { InjectionToken, inject } from '@angular/core';\nimport type { NgpFormControl } from './form-control.directive';\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","/**\n * Copyright © 2024 Angular Primitives.\n * https://github.com/ng-primitives/ng-primitives\n *\n * This source code is licensed under the CC BY-ND 4.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { Directive, computed, effect, input } from '@angular/core';\nimport { uniqueId } from 'ng-primitives/utils';\nimport { injectFormField } from '../form-field/form-field.token';\nimport { NgpFormControlToken } from './form-control.token';\n\n@Directive({\n standalone: true,\n selector: '[ngpFormControl]',\n exportAs: 'ngpFormControl',\n providers: [{ provide: NgpFormControlToken, useExisting: NgpFormControl }],\n host: {\n '[attr.aria-labelledby]': 'ariaLabelledBy()',\n '[attr.aria-describedby]': 'ariaDescribedBy()',\n '[attr.data-invalid]': 'formField.invalid()',\n '[attr.data-valid]': 'formField.valid()',\n '[attr.data-touched]': 'formField.touched()',\n '[attr.data-pristine]': 'formField.pristine()',\n '[attr.data-dirty]': 'formField.dirty()',\n '[attr.data-pending]': 'formField.pending()',\n '[attr.data-disabled]': 'formField.disabled()',\n },\n})\nexport class NgpFormControl {\n /**\n * Access the form field that the form control is associated with.\n */\n protected readonly formField = injectFormField('NgpFormControl');\n\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 * 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(\n onCleanup => {\n this.formField.setFormControl(this.id());\n onCleanup(() => this.formField.removeFormControl());\n },\n { allowSignalWrites: true },\n );\n }\n}\n","/**\n * Copyright © 2024 Angular Primitives.\n * https://github.com/ng-primitives/ng-primitives\n *\n * This source code is licensed under the CC BY-ND 4.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { InjectionToken, inject } from '@angular/core';\nimport type { NgpError } from './error.directive';\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","/**\n * Copyright © 2024 Angular Primitives.\n * https://github.com/ng-primitives/ng-primitives\n *\n * This source code is licensed under the CC BY-ND 4.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport {\n Directive,\n OnChanges,\n OnDestroy,\n OnInit,\n SimpleChanges,\n computed,\n input,\n} from '@angular/core';\nimport { uniqueId } from 'ng-primitives/utils';\nimport { injectFormField } from '../form-field/form-field.token';\nimport { NgpErrorToken } from './error.token';\n\n@Directive({\n standalone: true,\n selector: '[ngpError]',\n exportAs: 'ngpError',\n providers: [{ provide: NgpErrorToken, useExisting: NgpError }],\n host: {\n '[attr.id]': 'id()',\n '[attr.data-invalid]': 'formField.invalid()',\n '[attr.data-valid]': 'formField.valid()',\n '[attr.data-touched]': 'formField.touched()',\n '[attr.data-pristine]': 'formField.pristine()',\n '[attr.data-dirty]': 'formField.dirty()',\n '[attr.data-pending]': 'formField.pending()',\n '[attr.data-disabled]': 'formField.disabled()',\n '[attr.data-validator]': 'state()',\n },\n})\nexport class NgpError implements OnInit, OnChanges, OnDestroy {\n /**\n * Access the form field that the description is associated with.\n */\n protected readonly formField = injectFormField('NgpError');\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 whether the validator associated with this error is failing.\n */\n protected readonly state = computed(() => {\n const errors = this.formField.errors();\n const validator = this.validator();\n\n // if there is no validator, then we mark as invalid when the control is invalid.\n if (!validator) {\n return null;\n }\n\n return validator && errors.includes(validator) ? 'fail' : 'pass';\n });\n\n ngOnInit(): void {\n this.formField.addDescription(this.id());\n }\n\n ngOnChanges(changes: SimpleChanges): void {\n if ('id' in changes) {\n this.formField.removeDescription(changes['id'].previousValue);\n this.formField.addDescription(changes['id'].currentValue);\n }\n }\n\n ngOnDestroy(): void {\n this.formField.removeDescription(this.id());\n }\n}\n","/**\n * Copyright © 2024 Angular Primitives.\n * https://github.com/ng-primitives/ng-primitives\n *\n * This source code is licensed under the CC BY-ND 4.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nexport { NgpFormField } from './form-field/form-field.directive';\nexport { NgpFormFieldToken } from './form-field/form-field.token';\nexport { NgpLabel } from './label/label.directive';\nexport { NgpLabelToken } from './label/label.token';\nexport { NgpDescription } from './description/description.directive';\nexport { NgpDescriptionToken } from './description/description.token';\nexport { NgpFormControl } from './form-control/form-control.directive';\nexport { NgpFormControlToken } from './form-control/form-control.token';\nexport { NgpError } from './error/error.directive';\nexport { NgpErrorToken } from './error/error.token';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;AAAA;;;;;;AAMG;MAIU,iBAAiB,GAAG,IAAI,cAAc,CAAe,mBAAmB,EAAE;AAEvF;;;AAGG;AACG,SAAU,eAAe,CAAC,SAAiB,EAAA;AAC/C,IAAA,MAAM,SAAS,GAAG,MAAM,CAAC,iBAAiB,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;IAEhE,IAAI,CAAC,SAAS,EAAE;AACd,QAAA,MAAM,IAAI,KAAK,CAAC,OAAO,SAAS,CAAA,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packages/ng-primitives/form-field/src/form-field/form-field.directive.ts","../../../../packages/ng-primitives/form-field/src/label/label.token.ts","../../../../packages/ng-primitives/form-field/src/label/label.directive.ts","../../../../packages/ng-primitives/form-field/src/description/description.token.ts","../../../../packages/ng-primitives/form-field/src/description/description.directive.ts","../../../../packages/ng-primitives/form-field/src/form-control/form-control.token.ts","../../../../packages/ng-primitives/form-field/src/form-control/form-control.directive.ts","../../../../packages/ng-primitives/form-field/src/error/error.token.ts","../../../../packages/ng-primitives/form-field/src/error/error.directive.ts","../../../../packages/ng-primitives/form-field/src/index.ts","../../../../packages/ng-primitives/form-field/src/ng-primitives-form-field.ts"],"sourcesContent":["/**\n * Copyright © 2024 Angular Primitives.\n * https://github.com/ng-primitives/ng-primitives\n *\n * This source code is licensed under the CC BY-ND 4.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { InjectionToken, inject } from '@angular/core';\nimport type { NgpFormField } from './form-field.directive';\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","/**\n * Copyright © 2024 Angular Primitives.\n * https://github.com/ng-primitives/ng-primitives\n *\n * This source code is licensed under the CC BY-ND 4.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { 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@Directive({\n standalone: true,\n selector: '[ngpFormField]',\n exportAs: 'ngpFormField',\n providers: [{ provide: NgpFormFieldToken, useExisting: NgpFormField }],\n host: {\n '[attr.data-invalid]': 'invalid()',\n '[attr.data-valid]': 'valid()',\n '[attr.data-touched]': 'touched()',\n '[attr.data-pristine]': 'pristine()',\n '[attr.data-dirty]': 'dirty()',\n '[attr.data-pending]': 'pending()',\n '[attr.data-disabled]': 'disabled()',\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","/**\n * Copyright © 2024 Angular Primitives.\n * https://github.com/ng-primitives/ng-primitives\n *\n * This source code is licensed under the CC BY-ND 4.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { InjectionToken, inject } from '@angular/core';\nimport type { NgpLabel } from './label.directive';\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","/**\n * Copyright © 2024 Angular Primitives.\n * https://github.com/ng-primitives/ng-primitives\n *\n * This source code is licensed under the CC BY-ND 4.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport {\n Directive,\n ElementRef,\n HostListener,\n computed,\n effect,\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@Directive({\n standalone: true,\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()',\n '[attr.data-valid]': 'formField?.valid()',\n '[attr.data-touched]': 'formField?.touched()',\n '[attr.data-pristine]': 'formField?.pristine()',\n '[attr.data-dirty]': 'formField?.dirty()',\n '[attr.data-pending]': 'formField?.pending()',\n '[attr.data-disabled]': 'formField?.disabled()',\n },\n})\nexport class NgpLabel {\n /**\n * Access the element that the label is associated with.\n */\n private readonly elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n\n /**\n * Access the form field that the label is associated with.\n */\n protected readonly formField = injectFormField();\n\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 /**\n * Determine if the label is an HTML label element.\n */\n protected readonly isLabel = this.elementRef.nativeElement instanceof HTMLLabelElement;\n\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 constructor() {\n effect(\n onCleanup => {\n this.formField?.addLabel(this.id());\n onCleanup(() => this.formField?.removeLabel(this.id()));\n },\n { allowSignalWrites: true },\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 * Copyright © 2024 Angular Primitives.\n * https://github.com/ng-primitives/ng-primitives\n *\n * This source code is licensed under the CC BY-ND 4.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { InjectionToken, inject } from '@angular/core';\nimport type { NgpDescription } from './description.directive';\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","/**\n * Copyright © 2024 Angular Primitives.\n * https://github.com/ng-primitives/ng-primitives\n *\n * This source code is licensed under the CC BY-ND 4.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { 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@Directive({\n standalone: true,\n selector: '[ngpDescription]',\n exportAs: 'ngpDescription',\n providers: [{ provide: NgpDescriptionToken, useExisting: NgpDescription }],\n host: {\n '[attr.id]': 'id()',\n '[attr.data-invalid]': 'formField?.invalid()',\n '[attr.data-valid]': 'formField?.valid()',\n '[attr.data-touched]': 'formField?.touched()',\n '[attr.data-pristine]': 'formField?.pristine()',\n '[attr.data-dirty]': 'formField?.dirty()',\n '[attr.data-pending]': 'formField?.pending()',\n '[attr.data-disabled]': 'formField?.disabled()',\n },\n})\nexport class NgpDescription {\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 description. If not provided, a unique id will be generated.\n */\n readonly id = input<string>(uniqueId('ngp-description'));\n\n constructor() {\n effect(\n onCleanup => {\n this.formField?.addDescription(this.id());\n onCleanup(() => this.formField?.removeDescription(this.id()));\n },\n { allowSignalWrites: true },\n );\n }\n}\n","/**\n * Copyright © 2024 Angular Primitives.\n * https://github.com/ng-primitives/ng-primitives\n *\n * This source code is licensed under the CC BY-ND 4.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { InjectionToken, inject } from '@angular/core';\nimport type { NgpFormControl } from './form-control.directive';\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","/**\n * Copyright © 2024 Angular Primitives.\n * https://github.com/ng-primitives/ng-primitives\n *\n * This source code is licensed under the CC BY-ND 4.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { Directive, computed, 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@Directive({\n standalone: true,\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()',\n '[attr.data-valid]': 'formField?.valid()',\n '[attr.data-touched]': 'formField?.touched()',\n '[attr.data-pristine]': 'formField?.pristine()',\n '[attr.data-dirty]': 'formField?.dirty()',\n '[attr.data-pending]': 'formField?.pending()',\n '[attr.data-disabled]': 'formField?.disabled() || disabled()',\n },\n})\nexport class NgpFormControl {\n /**\n * Access the form field that the form control is associated with.\n */\n protected readonly formField = injectFormField();\n\n /**\n * Whether the form control is disabled by a parent.\n */\n protected readonly disabled = injectDisabled();\n\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 * 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(\n onCleanup => {\n this.formField?.setFormControl(this.id());\n onCleanup(() => this.formField?.removeFormControl());\n },\n { allowSignalWrites: true },\n );\n }\n}\n","/**\n * Copyright © 2024 Angular Primitives.\n * https://github.com/ng-primitives/ng-primitives\n *\n * This source code is licensed under the CC BY-ND 4.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { InjectionToken, inject } from '@angular/core';\nimport type { NgpError } from './error.directive';\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","/**\n * Copyright © 2024 Angular Primitives.\n * https://github.com/ng-primitives/ng-primitives\n *\n * This source code is licensed under the CC BY-ND 4.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { 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@Directive({\n standalone: true,\n selector: '[ngpError]',\n exportAs: 'ngpError',\n providers: [{ provide: NgpErrorToken, useExisting: NgpError }],\n host: {\n '[attr.id]': 'id()',\n '[attr.data-invalid]': 'formField?.invalid()',\n '[attr.data-valid]': 'formField?.valid()',\n '[attr.data-touched]': 'formField?.touched()',\n '[attr.data-pristine]': 'formField?.pristine()',\n '[attr.data-dirty]': 'formField?.dirty()',\n '[attr.data-pending]': 'formField?.pending()',\n '[attr.data-disabled]': 'formField?.disabled()',\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","/**\n * Copyright © 2024 Angular Primitives.\n * https://github.com/ng-primitives/ng-primitives\n *\n * This source code is licensed under the CC BY-ND 4.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nexport { NgpFormField } from './form-field/form-field.directive';\nexport { NgpFormFieldToken } from './form-field/form-field.token';\nexport { NgpLabel } from './label/label.directive';\nexport { NgpLabelToken } from './label/label.token';\nexport { NgpDescription } from './description/description.directive';\nexport { NgpDescriptionToken } from './description/description.token';\nexport { NgpFormControl } from './form-control/form-control.directive';\nexport { NgpFormControlToken } from './form-control/form-control.token';\nexport { NgpError } from './error/error.directive';\nexport { NgpErrorToken } from './error/error.token';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;AAAA;;;;;;AAMG;MAIU,iBAAiB,GAAG,IAAI,cAAc,CAAe,mBAAmB,EAAE;AAEvF;;;AAGG;SACa,eAAe,GAAA;IAC7B,OAAO,MAAM,C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AAA,MAAA,EAAA,mBAAA,EAAA,sBAAA,EAAA,iBAAA,EAAA,oBAAA,EAAA,mBAAA,EAAA,sBAAA,EAAA,oBAAA,EAAA,uBAAA,EAAA,iBAAA,EAAA,oBAAA,EAAA,mBAAA,EAAA,sBAAA,EAAA,oBAAA,EAAA,uBAAA,EAAA,qBAAA,EAAA,SAAA,EAAA,EAAA,EAAA,SAAA,EAbR,CAAC,EAAE,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,QAAQ,EAAE,CAAC,EAAA,QAAA,EAAA,CAAA,UAAA,CAAA,EAAA,aAAA,EAAA,IAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA,EAAA;;2FAanD,QAAQ,EAAA,UAAA,EAAA,CAAA;kBAjBpB,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,UAAU,EAAE,IAAI;AAChB,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,qBAAqB,EAAE,sBAAsB;AAC7C,wBAAA,mBAAmB,EAAE,oBAAoB;AACzC,wBAAA,qBAAqB,EAAE,sBAAsB;AAC7C,wBAAA,sBAAsB,EAAE,uBAAuB;AAC/C,wBAAA,mBAAmB,EAAE,oBAAoB;AACzC,wBAAA,qBAAqB,EAAE,sBAAsB;AAC7C,wBAAA,sBAAsB,EAAE,uBAAuB;AAC/C,wBAAA,uBAAuB,EAAE,SAAS;AACnC,qBAAA;AACF,iBAAA,CAAA;;;AC5BD;;;;;;AAMG;;ACNH;;AAEG;;;;"}
@@ -0,0 +1,84 @@
1
+ import * as i0 from '@angular/core';
2
+ import { InjectionToken, inject, ElementRef, input, booleanAttribute, signal, Directive, HostListener } from '@angular/core';
3
+ import * as i3 from 'ng-primitives/autofill';
4
+ import { NgpAutofill } from 'ng-primitives/autofill';
5
+ import * as i1 from 'ng-primitives/form-field';
6
+ import { NgpFormControl } from 'ng-primitives/form-field';
7
+ import * as i2 from 'ng-primitives/interactions';
8
+ import { NgpHover, NgpFocus, NgpPress } from 'ng-primitives/interactions';
9
+ import { NgpDisabledToken } from 'ng-primitives/internal';
10
+
11
+ /**
12
+ * Copyright © 2024 Angular Primitives.
13
+ * https://github.com/ng-primitives/ng-primitives
14
+ *
15
+ * This source code is licensed under the CC BY-ND 4.0 license found in the
16
+ * LICENSE file in the root directory of this source tree.
17
+ */
18
+ const NgpInputToken = new InjectionToken('NgpInputToken');
19
+ /**
20
+ * Inject the Input directive instance
21
+ */
22
+ function injectInput() {
23
+ return inject(NgpInputToken);
24
+ }
25
+
26
+ class NgpInput {
27
+ constructor() {
28
+ /**
29
+ * Access the underlying input element.
30
+ * @internal
31
+ */
32
+ this.element = inject(ElementRef);
33
+ /**
34
+ * Whether the element is disabled.
35
+ */
36
+ this.disabled = input(false, {
37
+ transform: booleanAttribute,
38
+ });
39
+ /**
40
+ * Sync the input value.
41
+ * @internal
42
+ */
43
+ this.value = signal(this.element.nativeElement.value);
44
+ }
45
+ valueDidChange() {
46
+ this.value.set(this.element.nativeElement.value);
47
+ }
48
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: NgpInput, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
49
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "18.1.1", type: NgpInput, isStandalone: true, selector: "input[ngpInput]", inputs: { disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "input": "valueDidChange()" } }, providers: [
50
+ { provide: NgpInputToken, useExisting: NgpInput },
51
+ { provide: NgpDisabledToken, useExisting: NgpInput },
52
+ ], exportAs: ["ngpInput"], hostDirectives: [{ directive: i1.NgpFormControl }, { directive: i2.NgpHover }, { directive: i2.NgpFocus }, { directive: i2.NgpPress }, { directive: i3.NgpAutofill }], ngImport: i0 }); }
53
+ }
54
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: NgpInput, decorators: [{
55
+ type: Directive,
56
+ args: [{
57
+ standalone: true,
58
+ selector: 'input[ngpInput]',
59
+ exportAs: 'ngpInput',
60
+ providers: [
61
+ { provide: NgpInputToken, useExisting: NgpInput },
62
+ { provide: NgpDisabledToken, useExisting: NgpInput },
63
+ ],
64
+ hostDirectives: [NgpFormControl, NgpHover, NgpFocus, NgpPress, NgpAutofill],
65
+ }]
66
+ }], propDecorators: { valueDidChange: [{
67
+ type: HostListener,
68
+ args: ['input']
69
+ }] } });
70
+
71
+ /**
72
+ * Copyright © 2024 Angular Primitives.
73
+ * https://github.com/ng-primitives/ng-primitives
74
+ *
75
+ * This source code is licensed under the CC BY-ND 4.0 license found in the
76
+ * LICENSE file in the root directory of this source tree.
77
+ */
78
+
79
+ /**
80
+ * Generated bundle index. Do not edit.
81
+ */
82
+
83
+ export { NgpInput, NgpInputToken };
84
+ //# sourceMappingURL=ng-primitives-input.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ng-primitives-input.mjs","sources":["../../../../packages/ng-primitives/input/src/input/input.token.ts","../../../../packages/ng-primitives/input/src/input/input.directive.ts","../../../../packages/ng-primitives/input/src/index.ts","../../../../packages/ng-primitives/input/src/ng-primitives-input.ts"],"sourcesContent":["/**\n * Copyright © 2024 Angular Primitives.\n * https://github.com/ng-primitives/ng-primitives\n *\n * This source code is licensed under the CC BY-ND 4.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { InjectionToken, inject } from '@angular/core';\nimport type { NgpInput } from './input.directive';\n\nexport const NgpInputToken = new InjectionToken<NgpInput>('NgpInputToken');\n\n/**\n * Inject the Input directive instance\n */\nexport function injectInput(): NgpInput {\n return inject(NgpInputToken);\n}\n","/**\n * Copyright © 2024 Angular Primitives.\n * https://github.com/ng-primitives/ng-primitives\n *\n * This source code is licensed under the CC BY-ND 4.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { BooleanInput } from '@angular/cdk/coercion';\nimport {\n booleanAttribute,\n Directive,\n ElementRef,\n HostListener,\n inject,\n input,\n signal,\n} from '@angular/core';\nimport { NgpAutofill } from 'ng-primitives/autofill';\nimport { NgpFormControl } from 'ng-primitives/form-field';\nimport { NgpFocus, NgpHover, NgpPress } from 'ng-primitives/interactions';\nimport { NgpCanDisable, NgpDisabledToken } from 'ng-primitives/internal';\nimport { NgpInputToken } from './input.token';\n\n@Directive({\n standalone: true,\n selector: 'input[ngpInput]',\n exportAs: 'ngpInput',\n providers: [\n { provide: NgpInputToken, useExisting: NgpInput },\n { provide: NgpDisabledToken, useExisting: NgpInput },\n ],\n hostDirectives: [NgpFormControl, NgpHover, NgpFocus, NgpPress, NgpAutofill],\n})\nexport class NgpInput implements NgpCanDisable {\n /**\n * Access the underlying input element.\n * @internal\n */\n readonly element = inject<ElementRef<HTMLInputElement>>(ElementRef);\n\n /**\n * Whether the element is disabled.\n */\n readonly disabled = input<boolean, BooleanInput>(false, {\n transform: booleanAttribute,\n });\n\n /**\n * Sync the input value.\n * @internal\n */\n readonly value = signal<string>(this.element.nativeElement.value);\n\n @HostListener('input')\n protected valueDidChange(): void {\n this.value.set(this.element.nativeElement.value);\n }\n}\n","/**\n * Copyright © 2024 Angular Primitives.\n * https://github.com/ng-primitives/ng-primitives\n *\n * This source code is licensed under the CC BY-ND 4.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nexport { NgpInput } from './input/input.directive';\nexport { NgpInputToken } from './input/input.token';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;AAAA;;;;;;AAMG;MAIU,aAAa,GAAG,IAAI,cAAc,CAAW,eAAe,EAAE;AAE3E;;AAEG;SACa,WAAW,GAAA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