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
@@ -77,10 +77,10 @@ class NgpResize {
77
77
  .pipe(takeUntilDestroyed(this.destroyRef))
78
78
  .subscribe(event => this.ngZone.run(() => this.didResize.emit(event)));
79
79
  }
80
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.2", ngImport: i0, type: NgpResize, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
81
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.0.2", type: NgpResize, isStandalone: true, selector: "[ngpResize]", outputs: { didResize: "ngpResize" }, ngImport: i0 }); }
80
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: NgpResize, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
81
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.1.1", type: NgpResize, isStandalone: true, selector: "[ngpResize]", outputs: { didResize: "ngpResize" }, ngImport: i0 }); }
82
82
  }
83
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.2", ngImport: i0, type: NgpResize, decorators: [{
83
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: NgpResize, decorators: [{
84
84
  type: Directive,
85
85
  args: [{
86
86
  selector: '[ngpResize]',
@@ -1,6 +1,7 @@
1
1
  import { Directionality } from '@angular/cdk/bidi';
2
2
  import * as i0 from '@angular/core';
3
3
  import { InjectionToken, inject, model, input, booleanAttribute, signal, Directive, ElementRef, computed, HostListener } from '@angular/core';
4
+ import { injectOrientation } from 'ng-primitives/internal';
4
5
  import { FocusMonitor } from '@angular/cdk/a11y';
5
6
 
6
7
  /**
@@ -32,6 +33,10 @@ class NgpRovingFocusGroup {
32
33
  this.orientation = model('vertical', {
33
34
  alias: 'ngpRovingFocusGroupOrientation',
34
35
  });
36
+ /**
37
+ * Determine the orientation of the roving focus group.
38
+ */
39
+ this.groupOrientation = injectOrientation(this.orientation);
35
40
  /**
36
41
  * Determine if focus should wrap when the end or beginning is reached.
37
42
  */
@@ -197,19 +202,19 @@ class NgpRovingFocusGroup {
197
202
  }
198
203
  switch (event.key) {
199
204
  case 'ArrowUp':
200
- if (this.orientation() === 'vertical') {
205
+ if (this.groupOrientation() === 'vertical') {
201
206
  event.preventDefault();
202
207
  this.activatePreviousItem('keyboard');
203
208
  }
204
209
  break;
205
210
  case 'ArrowDown':
206
- if (this.orientation() === 'vertical') {
211
+ if (this.groupOrientation() === 'vertical') {
207
212
  event.preventDefault();
208
213
  this.activateNextItem('keyboard');
209
214
  }
210
215
  break;
211
216
  case 'ArrowLeft':
212
- if (this.orientation() === 'horizontal') {
217
+ if (this.groupOrientation() === 'horizontal') {
213
218
  event.preventDefault();
214
219
  if (this.directionality.value === 'ltr') {
215
220
  this.activatePreviousItem('keyboard');
@@ -220,7 +225,7 @@ class NgpRovingFocusGroup {
220
225
  }
221
226
  break;
222
227
  case 'ArrowRight':
223
- if (this.orientation() === 'horizontal') {
228
+ if (this.groupOrientation() === 'horizontal') {
224
229
  event.preventDefault();
225
230
  if (this.directionality.value === 'ltr') {
226
231
  this.activateNextItem('keyboard');
@@ -244,10 +249,10 @@ class NgpRovingFocusGroup {
244
249
  break;
245
250
  }
246
251
  }
247
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.2", ngImport: i0, type: NgpRovingFocusGroup, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
248
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "18.0.2", type: NgpRovingFocusGroup, isStandalone: true, selector: "[ngpRovingFocusGroup]", inputs: { orientation: { classPropertyName: "orientation", publicName: "ngpRovingFocusGroupOrientation", isSignal: true, isRequired: false, transformFunction: null }, wrap: { classPropertyName: "wrap", publicName: "ngpRovingFocusGroupWrap", isSignal: true, isRequired: false, transformFunction: null }, homeEnd: { classPropertyName: "homeEnd", publicName: "ngpRovingFocusGroupHomeEnd", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "ngpRovingFocusGroupDisabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { orientation: "ngpRovingFocusGroupOrientationChange" }, providers: [{ provide: NgpRovingFocusGroupToken, useExisting: NgpRovingFocusGroup }], exportAs: ["ngpRovingFocusGroup"], ngImport: i0 }); }
252
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: NgpRovingFocusGroup, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
253
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "18.1.1", type: NgpRovingFocusGroup, isStandalone: true, selector: "[ngpRovingFocusGroup]", inputs: { orientation: { classPropertyName: "orientation", publicName: "ngpRovingFocusGroupOrientation", isSignal: true, isRequired: false, transformFunction: null }, wrap: { classPropertyName: "wrap", publicName: "ngpRovingFocusGroupWrap", isSignal: true, isRequired: false, transformFunction: null }, homeEnd: { classPropertyName: "homeEnd", publicName: "ngpRovingFocusGroupHomeEnd", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "ngpRovingFocusGroupDisabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { orientation: "ngpRovingFocusGroupOrientationChange" }, providers: [{ provide: NgpRovingFocusGroupToken, useExisting: NgpRovingFocusGroup }], exportAs: ["ngpRovingFocusGroup"], ngImport: i0 }); }
249
254
  }
250
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.2", ngImport: i0, type: NgpRovingFocusGroup, decorators: [{
255
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: NgpRovingFocusGroup, decorators: [{
251
256
  type: Directive,
252
257
  args: [{
253
258
  standalone: true,
@@ -344,10 +349,10 @@ class NgpRovingFocusItem {
344
349
  focus(origin) {
345
350
  this.focusMonitor.focusVia(this.elementRef, origin);
346
351
  }
347
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.2", ngImport: i0, type: NgpRovingFocusItem, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
348
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "18.0.2", type: NgpRovingFocusItem, isStandalone: true, selector: "[ngpRovingFocusItem]", inputs: { disabled: { classPropertyName: "disabled", publicName: "ngpRovingFocusItemDisabled", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "keydown": "onKeydown($event)", "click": "activate()" }, properties: { "attr.tabindex": "tabindex()" } }, providers: [{ provide: NgpRovingFocusItemToken, useExisting: NgpRovingFocusItem }], exportAs: ["ngpRovingFocusItem"], ngImport: i0 }); }
352
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: NgpRovingFocusItem, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
353
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "18.1.1", type: NgpRovingFocusItem, isStandalone: true, selector: "[ngpRovingFocusItem]", inputs: { disabled: { classPropertyName: "disabled", publicName: "ngpRovingFocusItemDisabled", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "keydown": "onKeydown($event)", "click": "activate()" }, properties: { "attr.tabindex": "tabindex()" } }, providers: [{ provide: NgpRovingFocusItemToken, useExisting: NgpRovingFocusItem }], exportAs: ["ngpRovingFocusItem"], ngImport: i0 }); }
349
354
  }
350
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.2", ngImport: i0, type: NgpRovingFocusItem, decorators: [{
355
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: NgpRovingFocusItem, decorators: [{
351
356
  type: Directive,
352
357
  args: [{
353
358
  standalone: true,
@@ -1 +1 @@
1
- {"version":3,"file":"ng-primitives-roving-focus.mjs","sources":["../../../../packages/ng-primitives/roving-focus/src/roving-focus-group/roving-focus-group.token.ts","../../../../packages/ng-primitives/roving-focus/src/roving-focus-group/roving-focus-group.directive.ts","../../../../packages/ng-primitives/roving-focus/src/roving-focus-item/roving-focus-item.token.ts","../../../../packages/ng-primitives/roving-focus/src/roving-focus-item/roving-focus-item.directive.ts","../../../../packages/ng-primitives/roving-focus/src/index.ts","../../../../packages/ng-primitives/roving-focus/src/ng-primitives-roving-focus.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 { NgpRovingFocusGroup } from './roving-focus-group.directive';\n\nexport const NgpRovingFocusGroupToken = new InjectionToken<NgpRovingFocusGroup>(\n 'NgpRovingFocusGroupToken',\n);\n\n/**\n * Inject the RovingFocusGroup directive instance\n * @returns The RovingFocusGroup directive instance\n */\nexport function injectRovingFocusGroup(): NgpRovingFocusGroup {\n return inject(NgpRovingFocusGroupToken);\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 { FocusOrigin } from '@angular/cdk/a11y';\nimport { Directionality } from '@angular/cdk/bidi';\nimport { BooleanInput } from '@angular/cdk/coercion';\nimport { Directive, booleanAttribute, inject, input, model, signal } from '@angular/core';\nimport { NgpRovingFocusItem } from '../roving-focus-item/roving-focus-item.directive';\nimport { NgpRovingFocusGroupToken } from './roving-focus-group.token';\n\n@Directive({\n standalone: true,\n selector: '[ngpRovingFocusGroup]',\n exportAs: 'ngpRovingFocusGroup',\n providers: [{ provide: NgpRovingFocusGroupToken, useExisting: NgpRovingFocusGroup }],\n})\nexport class NgpRovingFocusGroup {\n /**\n * Access the directionality service.\n */\n private readonly directionality = inject(Directionality);\n\n /**\n * Determine the orientation of the roving focus group.\n * @default 'vertical'\n */\n readonly orientation = model<'horizontal' | 'vertical'>('vertical', {\n alias: 'ngpRovingFocusGroupOrientation',\n });\n\n /**\n * Determine if focus should wrap when the end or beginning is reached.\n */\n readonly wrap = input<boolean, BooleanInput>(true, {\n alias: 'ngpRovingFocusGroupWrap',\n transform: booleanAttribute,\n });\n\n /**\n * Determine if the home and end keys should navigate to the first and last items.\n */\n readonly homeEnd = input<boolean, BooleanInput>(true, {\n alias: 'ngpRovingFocusGroupHomeEnd',\n transform: booleanAttribute,\n });\n\n /**\n * Determine if the roving focus group is disabled.\n */\n readonly disabled = input<boolean, BooleanInput>(false, {\n alias: 'ngpRovingFocusGroupDisabled',\n transform: booleanAttribute,\n });\n\n /**\n * Store the items in the roving focus group.\n */\n private readonly items = signal<NgpRovingFocusItem[]>([]);\n\n /**\n * Get the items in the roving focus group sorted by order.\n */\n private get sortedItems() {\n return this.items().sort((a, b) => {\n // sort the items by their position in the document\n return a.elementRef.nativeElement.compareDocumentPosition(b.elementRef.nativeElement) &\n Node.DOCUMENT_POSITION_FOLLOWING\n ? -1\n : 1;\n });\n }\n\n /**\n * Store the active item in the roving focus group.\n * @internal\n */\n readonly activeItem = signal<NgpRovingFocusItem | null>(null);\n\n /**\n * Register an item with the roving focus group.\n * @param item The item to register\n * @internal\n */\n register(item: NgpRovingFocusItem): void {\n this.items.update(items => [...items, item]);\n\n // if there is no active item, make the first item the tabbable item\n if (!this.activeItem()) {\n this.activeItem.set(item);\n }\n }\n\n /**\n * Unregister an item with the roving focus group.\n * @param item The item to unregister\n * @internal\n */\n unregister(item: NgpRovingFocusItem): void {\n this.items.update(items => items.filter(i => i !== item));\n\n // check if the unregistered item is the active item\n if (this.activeItem() === item) {\n // if the active item is unregistered, activate the first item\n this.activeItem.set(this.items()[0] ?? null);\n }\n }\n\n /**\n * Activate an item in the roving focus group.\n * @param item The item to activate\n * @param origin The origin of the focus change\n */\n setActiveItem(item: NgpRovingFocusItem | null, origin: FocusOrigin = 'program'): void {\n this.activeItem.set(item);\n item?.focus(origin);\n }\n\n /**\n * Activate the first item in the roving focus group.\n * @param origin The origin of the focus change\n */\n private activateFirstItem(origin: FocusOrigin): void {\n // find the first item that is not disabled\n const item = this.sortedItems.find(i => !i.disabled()) ?? null;\n\n // set the first item as the active item\n this.setActiveItem(item, origin);\n }\n\n /**\n * Activate the last item in the roving focus group.\n * @param origin The origin of the focus change\n */\n private activateLastItem(origin: FocusOrigin): void {\n // find the last item that is not disabled\n const item = [...this.sortedItems].reverse().find(i => !i.disabled()) ?? null;\n\n // set the last item as the active item\n this.setActiveItem(item, origin);\n }\n\n /**\n * Activate the next item in the roving focus group.\n * @param origin The origin of the focus change\n */\n private activateNextItem(origin: FocusOrigin): void {\n const activeItem = this.activeItem();\n\n // if there is no active item, activate the first item\n if (!activeItem) {\n this.activateFirstItem(origin);\n return;\n }\n\n // find the index of the active item\n const index = this.sortedItems.indexOf(activeItem);\n\n // find the next item that is not disabled\n const item = this.sortedItems.slice(index + 1).find(i => !i.disabled()) ?? null;\n\n // if we are at the end of the list, wrap to the beginning\n if (!item && this.wrap()) {\n this.activateFirstItem(origin);\n return;\n }\n\n // if there is no next item, do nothing\n if (!item) {\n return;\n }\n\n // set the next item as the active item\n this.setActiveItem(item, origin);\n }\n\n /**\n * Activate the previous item in the roving focus group.\n * @param origin The origin of the focus change\n */\n private activatePreviousItem(origin: FocusOrigin): void {\n const activeItem = this.activeItem();\n\n // if there is no active item, activate the last item\n if (!activeItem) {\n this.activateLastItem(origin);\n return;\n }\n\n // find the index of the active item\n const index = this.sortedItems.indexOf(activeItem);\n\n // find the previous item that is not disabled\n const item =\n this.sortedItems\n .slice(0, index)\n .reverse()\n .find(i => !i.disabled()) ?? null;\n\n // if we are at the beginning of the list, wrap to the end\n if (!item && this.wrap()) {\n this.activateLastItem(origin);\n return;\n }\n\n // if there is no previous item, do nothing\n if (!item) {\n return;\n }\n\n // set the previous item as the active item\n this.setActiveItem(item, origin);\n }\n\n /**\n * Handle keyboard navigation for the roving focus group.\n * @param event The keyboard event\n * @internal\n */\n onKeydown(event: KeyboardEvent): void {\n if (this.disabled()) {\n return;\n }\n\n switch (event.key) {\n case 'ArrowUp':\n if (this.orientation() === 'vertical') {\n event.preventDefault();\n this.activatePreviousItem('keyboard');\n }\n break;\n case 'ArrowDown':\n if (this.orientation() === 'vertical') {\n event.preventDefault();\n this.activateNextItem('keyboard');\n }\n break;\n case 'ArrowLeft':\n if (this.orientation() === 'horizontal') {\n event.preventDefault();\n\n if (this.directionality.value === 'ltr') {\n this.activatePreviousItem('keyboard');\n } else {\n this.activateNextItem('keyboard');\n }\n }\n break;\n case 'ArrowRight':\n if (this.orientation() === 'horizontal') {\n event.preventDefault();\n\n if (this.directionality.value === 'ltr') {\n this.activateNextItem('keyboard');\n } else {\n this.activatePreviousItem('keyboard');\n }\n }\n break;\n case 'Home':\n if (this.homeEnd()) {\n event.preventDefault();\n this.activateFirstItem('keyboard');\n }\n break;\n case 'End':\n if (this.homeEnd()) {\n event.preventDefault();\n this.activateLastItem('keyboard');\n }\n break;\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 { NgpRovingFocusItem } from './roving-focus-item.directive';\n\nexport const NgpRovingFocusItemToken = new InjectionToken<NgpRovingFocusItem>(\n 'NgpRovingFocusItemToken',\n);\n\n/**\n * Inject the RovingFocusItem directive instance\n * @returns The RovingFocusItem directive instance\n */\nexport function injectRovingFocusItem(): NgpRovingFocusItem {\n return inject(NgpRovingFocusItemToken);\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 { FocusMonitor, FocusOrigin } from '@angular/cdk/a11y';\nimport { BooleanInput } from '@angular/cdk/coercion';\nimport {\n Directive,\n ElementRef,\n HostListener,\n OnDestroy,\n OnInit,\n booleanAttribute,\n computed,\n inject,\n input,\n} from '@angular/core';\nimport { injectRovingFocusGroup } from '../roving-focus-group/roving-focus-group.token';\nimport { NgpRovingFocusItemToken } from './roving-focus-item.token';\n\n@Directive({\n standalone: true,\n selector: '[ngpRovingFocusItem]',\n exportAs: 'ngpRovingFocusItem',\n providers: [{ provide: NgpRovingFocusItemToken, useExisting: NgpRovingFocusItem }],\n host: {\n '[attr.tabindex]': 'tabindex()',\n },\n})\nexport class NgpRovingFocusItem implements OnInit, OnDestroy {\n /**\n * Access the group the roving focus item belongs to.\n */\n private readonly group = injectRovingFocusGroup();\n\n /**\n * Access the focus monitor service.\n */\n private readonly focusMonitor = inject(FocusMonitor);\n\n /**\n * Access the element the roving focus item is attached to.\n */\n readonly elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n\n /**\n * Define if the item is disabled.\n */\n readonly disabled = input<boolean, BooleanInput>(false, {\n alias: 'ngpRovingFocusItemDisabled',\n transform: booleanAttribute,\n });\n\n /**\n * Derive the tabindex of the roving focus item.\n */\n readonly tabindex = computed(() =>\n !this.group.disabled() && this.group.activeItem() === this ? 0 : -1,\n );\n\n /**\n * Initialize the roving focus item.\n */\n ngOnInit(): void {\n this.group.register(this);\n }\n\n /**\n * Clean up the roving focus item.\n */\n ngOnDestroy(): void {\n this.group.unregister(this);\n }\n\n /**\n * Forward the keydown event to the roving focus group.\n * @param event The keyboard event\n */\n @HostListener('keydown', ['$event'])\n protected onKeydown(event: KeyboardEvent): void {\n if (this.disabled()) {\n return;\n }\n\n this.group.onKeydown(event);\n }\n\n /**\n * Activate the roving focus item on click.\n */\n @HostListener('click')\n protected activate(): void {\n if (this.disabled()) {\n return;\n }\n\n this.group.setActiveItem(this, 'mouse');\n }\n\n /**\n * Focus the roving focus item.\n * @param origin The origin of the focus\n */\n focus(origin: FocusOrigin): void {\n this.focusMonitor.focusVia(this.elementRef, origin);\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 { NgpRovingFocusGroup } from './roving-focus-group/roving-focus-group.directive';\nexport {\n NgpRovingFocusGroupToken,\n injectRovingFocusGroup,\n} from './roving-focus-group/roving-focus-group.token';\nexport { NgpRovingFocusItem } from './roving-focus-item/roving-focus-item.directive';\nexport { NgpRovingFocusItemToken } from './roving-focus-item/roving-focus-item.token';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;AAAA;;;;;;AAMG;MAIU,wBAAwB,GAAG,IAAI,cAAc,CACxD,0BAA0B,EAC1B;AAEF;;;AAGG;SACa,sBAAsB,GAAA;AACpC,IAAA,OAAO,MAAM,CAAC,wBAAwB,CAAC,CAAC;AAC1C;;MCAa,mBAAmB,CAAA;AANhC,IAAA,WAAA,GAAA;AAOE;;AAEG;AAC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../../../../packages/ng-primitives/roving-focus/src/roving-focus-group/roving-focus-group.token.ts","../../../../packages/ng-primitives/roving-focus/src/roving-focus-group/roving-focus-group.directive.ts","../../../../packages/ng-primitives/roving-focus/src/roving-focus-item/roving-focus-item.token.ts","../../../../packages/ng-primitives/roving-focus/src/roving-focus-item/roving-focus-item.directive.ts","../../../../packages/ng-primitives/roving-focus/src/index.ts","../../../../packages/ng-primitives/roving-focus/src/ng-primitives-roving-focus.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 { NgpRovingFocusGroup } from './roving-focus-group.directive';\n\nexport const NgpRovingFocusGroupToken = new InjectionToken<NgpRovingFocusGroup>(\n 'NgpRovingFocusGroupToken',\n);\n\n/**\n * Inject the RovingFocusGroup directive instance\n * @returns The RovingFocusGroup directive instance\n */\nexport function injectRovingFocusGroup(): NgpRovingFocusGroup {\n return inject(NgpRovingFocusGroupToken);\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 { FocusOrigin } from '@angular/cdk/a11y';\nimport { Directionality } from '@angular/cdk/bidi';\nimport { BooleanInput } from '@angular/cdk/coercion';\nimport { booleanAttribute, Directive, inject, input, model, signal } from '@angular/core';\nimport { injectOrientation, NgpCanOrientate, NgpOrientation } from 'ng-primitives/internal';\nimport { NgpRovingFocusItem } from '../roving-focus-item/roving-focus-item.directive';\nimport { NgpRovingFocusGroupToken } from './roving-focus-group.token';\n\n@Directive({\n standalone: true,\n selector: '[ngpRovingFocusGroup]',\n exportAs: 'ngpRovingFocusGroup',\n providers: [{ provide: NgpRovingFocusGroupToken, useExisting: NgpRovingFocusGroup }],\n})\nexport class NgpRovingFocusGroup implements NgpCanOrientate {\n /**\n * Access the directionality service.\n */\n private readonly directionality = inject(Directionality);\n\n /**\n * Determine the orientation of the roving focus group.\n * @default 'vertical'\n */\n readonly orientation = model<NgpOrientation>('vertical', {\n alias: 'ngpRovingFocusGroupOrientation',\n });\n\n /**\n * Determine the orientation of the roving focus group.\n */\n readonly groupOrientation = injectOrientation(this.orientation);\n\n /**\n * Determine if focus should wrap when the end or beginning is reached.\n */\n readonly wrap = input<boolean, BooleanInput>(true, {\n alias: 'ngpRovingFocusGroupWrap',\n transform: booleanAttribute,\n });\n\n /**\n * Determine if the home and end keys should navigate to the first and last items.\n */\n readonly homeEnd = input<boolean, BooleanInput>(true, {\n alias: 'ngpRovingFocusGroupHomeEnd',\n transform: booleanAttribute,\n });\n\n /**\n * Determine if the roving focus group is disabled.\n */\n readonly disabled = input<boolean, BooleanInput>(false, {\n alias: 'ngpRovingFocusGroupDisabled',\n transform: booleanAttribute,\n });\n\n /**\n * Store the items in the roving focus group.\n */\n private readonly items = signal<NgpRovingFocusItem[]>([]);\n\n /**\n * Get the items in the roving focus group sorted by order.\n */\n private get sortedItems() {\n return this.items().sort((a, b) => {\n // sort the items by their position in the document\n return a.elementRef.nativeElement.compareDocumentPosition(b.elementRef.nativeElement) &\n Node.DOCUMENT_POSITION_FOLLOWING\n ? -1\n : 1;\n });\n }\n\n /**\n * Store the active item in the roving focus group.\n * @internal\n */\n readonly activeItem = signal<NgpRovingFocusItem | null>(null);\n\n /**\n * Register an item with the roving focus group.\n * @param item The item to register\n * @internal\n */\n register(item: NgpRovingFocusItem): void {\n this.items.update(items => [...items, item]);\n\n // if there is no active item, make the first item the tabbable item\n if (!this.activeItem()) {\n this.activeItem.set(item);\n }\n }\n\n /**\n * Unregister an item with the roving focus group.\n * @param item The item to unregister\n * @internal\n */\n unregister(item: NgpRovingFocusItem): void {\n this.items.update(items => items.filter(i => i !== item));\n\n // check if the unregistered item is the active item\n if (this.activeItem() === item) {\n // if the active item is unregistered, activate the first item\n this.activeItem.set(this.items()[0] ?? null);\n }\n }\n\n /**\n * Activate an item in the roving focus group.\n * @param item The item to activate\n * @param origin The origin of the focus change\n */\n setActiveItem(item: NgpRovingFocusItem | null, origin: FocusOrigin = 'program'): void {\n this.activeItem.set(item);\n item?.focus(origin);\n }\n\n /**\n * Activate the first item in the roving focus group.\n * @param origin The origin of the focus change\n */\n private activateFirstItem(origin: FocusOrigin): void {\n // find the first item that is not disabled\n const item = this.sortedItems.find(i => !i.disabled()) ?? null;\n\n // set the first item as the active item\n this.setActiveItem(item, origin);\n }\n\n /**\n * Activate the last item in the roving focus group.\n * @param origin The origin of the focus change\n */\n private activateLastItem(origin: FocusOrigin): void {\n // find the last item that is not disabled\n const item = [...this.sortedItems].reverse().find(i => !i.disabled()) ?? null;\n\n // set the last item as the active item\n this.setActiveItem(item, origin);\n }\n\n /**\n * Activate the next item in the roving focus group.\n * @param origin The origin of the focus change\n */\n private activateNextItem(origin: FocusOrigin): void {\n const activeItem = this.activeItem();\n\n // if there is no active item, activate the first item\n if (!activeItem) {\n this.activateFirstItem(origin);\n return;\n }\n\n // find the index of the active item\n const index = this.sortedItems.indexOf(activeItem);\n\n // find the next item that is not disabled\n const item = this.sortedItems.slice(index + 1).find(i => !i.disabled()) ?? null;\n\n // if we are at the end of the list, wrap to the beginning\n if (!item && this.wrap()) {\n this.activateFirstItem(origin);\n return;\n }\n\n // if there is no next item, do nothing\n if (!item) {\n return;\n }\n\n // set the next item as the active item\n this.setActiveItem(item, origin);\n }\n\n /**\n * Activate the previous item in the roving focus group.\n * @param origin The origin of the focus change\n */\n private activatePreviousItem(origin: FocusOrigin): void {\n const activeItem = this.activeItem();\n\n // if there is no active item, activate the last item\n if (!activeItem) {\n this.activateLastItem(origin);\n return;\n }\n\n // find the index of the active item\n const index = this.sortedItems.indexOf(activeItem);\n\n // find the previous item that is not disabled\n const item =\n this.sortedItems\n .slice(0, index)\n .reverse()\n .find(i => !i.disabled()) ?? null;\n\n // if we are at the beginning of the list, wrap to the end\n if (!item && this.wrap()) {\n this.activateLastItem(origin);\n return;\n }\n\n // if there is no previous item, do nothing\n if (!item) {\n return;\n }\n\n // set the previous item as the active item\n this.setActiveItem(item, origin);\n }\n\n /**\n * Handle keyboard navigation for the roving focus group.\n * @param event The keyboard event\n * @internal\n */\n onKeydown(event: KeyboardEvent): void {\n if (this.disabled()) {\n return;\n }\n\n switch (event.key) {\n case 'ArrowUp':\n if (this.groupOrientation() === 'vertical') {\n event.preventDefault();\n this.activatePreviousItem('keyboard');\n }\n break;\n case 'ArrowDown':\n if (this.groupOrientation() === 'vertical') {\n event.preventDefault();\n this.activateNextItem('keyboard');\n }\n break;\n case 'ArrowLeft':\n if (this.groupOrientation() === 'horizontal') {\n event.preventDefault();\n\n if (this.directionality.value === 'ltr') {\n this.activatePreviousItem('keyboard');\n } else {\n this.activateNextItem('keyboard');\n }\n }\n break;\n case 'ArrowRight':\n if (this.groupOrientation() === 'horizontal') {\n event.preventDefault();\n\n if (this.directionality.value === 'ltr') {\n this.activateNextItem('keyboard');\n } else {\n this.activatePreviousItem('keyboard');\n }\n }\n break;\n case 'Home':\n if (this.homeEnd()) {\n event.preventDefault();\n this.activateFirstItem('keyboard');\n }\n break;\n case 'End':\n if (this.homeEnd()) {\n event.preventDefault();\n this.activateLastItem('keyboard');\n }\n break;\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 { NgpRovingFocusItem } from './roving-focus-item.directive';\n\nexport const NgpRovingFocusItemToken = new InjectionToken<NgpRovingFocusItem>(\n 'NgpRovingFocusItemToken',\n);\n\n/**\n * Inject the RovingFocusItem directive instance\n * @returns The RovingFocusItem directive instance\n */\nexport function injectRovingFocusItem(): NgpRovingFocusItem {\n return inject(NgpRovingFocusItemToken);\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 { FocusMonitor, FocusOrigin } from '@angular/cdk/a11y';\nimport { BooleanInput } from '@angular/cdk/coercion';\nimport {\n Directive,\n ElementRef,\n HostListener,\n OnDestroy,\n OnInit,\n booleanAttribute,\n computed,\n inject,\n input,\n} from '@angular/core';\nimport { injectRovingFocusGroup } from '../roving-focus-group/roving-focus-group.token';\nimport { NgpRovingFocusItemToken } from './roving-focus-item.token';\n\n@Directive({\n standalone: true,\n selector: '[ngpRovingFocusItem]',\n exportAs: 'ngpRovingFocusItem',\n providers: [{ provide: NgpRovingFocusItemToken, useExisting: NgpRovingFocusItem }],\n host: {\n '[attr.tabindex]': 'tabindex()',\n },\n})\nexport class NgpRovingFocusItem implements OnInit, OnDestroy {\n /**\n * Access the group the roving focus item belongs to.\n */\n private readonly group = injectRovingFocusGroup();\n\n /**\n * Access the focus monitor service.\n */\n private readonly focusMonitor = inject(FocusMonitor);\n\n /**\n * Access the element the roving focus item is attached to.\n */\n readonly elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n\n /**\n * Define if the item is disabled.\n */\n readonly disabled = input<boolean, BooleanInput>(false, {\n alias: 'ngpRovingFocusItemDisabled',\n transform: booleanAttribute,\n });\n\n /**\n * Derive the tabindex of the roving focus item.\n */\n readonly tabindex = computed(() =>\n !this.group.disabled() && this.group.activeItem() === this ? 0 : -1,\n );\n\n /**\n * Initialize the roving focus item.\n */\n ngOnInit(): void {\n this.group.register(this);\n }\n\n /**\n * Clean up the roving focus item.\n */\n ngOnDestroy(): void {\n this.group.unregister(this);\n }\n\n /**\n * Forward the keydown event to the roving focus group.\n * @param event The keyboard event\n */\n @HostListener('keydown', ['$event'])\n protected onKeydown(event: KeyboardEvent): void {\n if (this.disabled()) {\n return;\n }\n\n this.group.onKeydown(event);\n }\n\n /**\n * Activate the roving focus item on click.\n */\n @HostListener('click')\n protected activate(): void {\n if (this.disabled()) {\n return;\n }\n\n this.group.setActiveItem(this, 'mouse');\n }\n\n /**\n * Focus the roving focus item.\n * @param origin The origin of the focus\n */\n focus(origin: FocusOrigin): void {\n this.focusMonitor.focusVia(this.elementRef, origin);\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 { NgpRovingFocusGroup } from './roving-focus-group/roving-focus-group.directive';\nexport {\n NgpRovingFocusGroupToken,\n injectRovingFocusGroup,\n} from './roving-focus-group/roving-focus-group.token';\nexport { NgpRovingFocusItem } from './roving-focus-item/roving-focus-item.directive';\nexport { NgpRovingFocusItemToken } from './roving-focus-item/roving-focus-item.token';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;AAAA;;;;;;AAMG;MAIU,wBAAwB,GAAG,IAAI,cAAc,CACxD,0BAA0B,EAC1B;AAEF;;;AAGG;SACa,sBAAsB,GAAA;AACpC,IAAA,OAAO,MAAM,CAAC,wBAAwB,CAAC,CAAC;AAC1C;;MCCa,mBAAmB,CAAA;AANhC,IAAA,WAAA,GAAA;AAOE;;AAEG;AACc,QAAA,IAAA,CAAA,cAAc,GAAG,MAAM,CAAC,cAAc,CAAC,CAAC;AAEzD;;;AAGG;AACM,QAAA,IAAA,CAAA,WAAW,GAAG,KAAK,CAAiB,UAAU,EAAE;AACvD,YAAA,KAAK,EAAE,gCAAgC;AACxC,SAAA,CAAC,CAAC;AAEH;;AAEG;AACM,QAAA,IAAA,CAAA,gBAAgB,GAAG,iBAAiB,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;AAEhE;;AAEG;AACM,QAAA,IAAA,CAAA,IAAI,GAAG,KAAK,CAAwB,IAAI,EAAE;AACjD,YAAA,KAAK,EAAE,yBAAyB;AAChC,YAAA,SAAS,EAAE,gBAAgB;AAC5B,SAA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,EAAA,SAAA,EAAA,EAAA,SAAA,EAAA,mBAAA,EAAA,OAAA,EAAA,YAAA,EAAA,EAAA,UAAA,EAAA,EAAA,eAAA,EAAA,YAAA,EAAA,EAAA,EAAA,SAAA,EALlB,CAAC,EAAE,OAAO,EAAE,uBAAuB,EAAE,WAAW,EAAE,kBAAkB,EAAE,CAAC,EAAA,QAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA,EAAA;;2FAKvE,kBAAkB,EAAA,UAAA,EAAA,CAAA;kBAT9B,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,UAAU,EAAE,IAAI;AAChB,oBAAA,QAAQ,EAAE,sBAAsB;AAChC,oBAAA,QAAQ,EAAE,oBAAoB;oBAC9B,SAAS,EAAE,CAAC,EAAE,OAAO,EAAE,uBAAuB,EAAE,WAAW,EAAoB,kBAAA,EAAE,CAAC;AAClF,oBAAA,IAAI,EAAE;AACJ,wBAAA,iBAAiB,EAAE,YAAY;AAChC,qBAAA;AACF,iBAAA,CAAA;8BAmDW,SAAS,EAAA,CAAA;sBADlB,YAAY;uBAAC,SAAS,EAAE,CAAC,QAAQ,CAAC,CAAA;gBAazB,QAAQ,EAAA,CAAA;sBADjB,YAAY;uBAAC,OAAO,CAAA;;;AC7FvB;;;;;;AAMG;;ACNH;;AAEG;;;;"}
@@ -0,0 +1,76 @@
1
+ import * as i0 from '@angular/core';
2
+ import { InjectionToken, inject, contentChild, computed, Directive, HostListener } from '@angular/core';
3
+ import * as i1 from 'ng-primitives/form-field';
4
+ import { NgpFormField } from 'ng-primitives/form-field';
5
+ import { NgpInputToken } from 'ng-primitives/input';
6
+
7
+ /**
8
+ * Copyright © 2024 Angular Primitives.
9
+ * https://github.com/ng-primitives/ng-primitives
10
+ *
11
+ * This source code is licensed under the CC BY-ND 4.0 license found in the
12
+ * LICENSE file in the root directory of this source tree.
13
+ */
14
+ const NgpSearchFieldToken = new InjectionToken('NgpSearchFieldToken');
15
+ /**
16
+ * Inject the SearchField directive instance
17
+ */
18
+ function injectSearchField() {
19
+ return inject(NgpSearchFieldToken);
20
+ }
21
+
22
+ /**
23
+ * Copyright © 2024 Angular Primitives.
24
+ * https://github.com/ng-primitives/ng-primitives
25
+ *
26
+ * This source code is licensed under the CC BY-ND 4.0 license found in the
27
+ * LICENSE file in the root directory of this source tree.
28
+ */
29
+ class NgpSearchField {
30
+ constructor() {
31
+ /**
32
+ * Access the child input field.
33
+ */
34
+ this.input = contentChild.required(NgpInputToken, { descendants: true });
35
+ /**
36
+ * Whether the input field is empty.
37
+ */
38
+ this.empty = computed(() => this.input().value() === '');
39
+ }
40
+ clear() {
41
+ this.input().element.nativeElement.value = '';
42
+ }
43
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: NgpSearchField, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
44
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "18.1.1", type: NgpSearchField, isStandalone: true, selector: "[ngpSearchField]", host: { listeners: { "keydown.escape": "clear()" }, properties: { "attr.data-empty": "empty()" } }, providers: [{ provide: NgpSearchFieldToken, useExisting: NgpSearchField }], queries: [{ propertyName: "input", first: true, predicate: NgpInputToken, descendants: true, isSignal: true }], exportAs: ["ngpSearchField"], hostDirectives: [{ directive: i1.NgpFormField }], ngImport: i0 }); }
45
+ }
46
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.1", ngImport: i0, type: NgpSearchField, decorators: [{
47
+ type: Directive,
48
+ args: [{
49
+ standalone: true,
50
+ selector: '[ngpSearchField]',
51
+ exportAs: 'ngpSearchField',
52
+ providers: [{ provide: NgpSearchFieldToken, useExisting: NgpSearchField }],
53
+ hostDirectives: [NgpFormField],
54
+ host: {
55
+ '[attr.data-empty]': 'empty()',
56
+ },
57
+ }]
58
+ }], propDecorators: { clear: [{
59
+ type: HostListener,
60
+ args: ['keydown.escape']
61
+ }] } });
62
+
63
+ /**
64
+ * Copyright © 2024 Angular Primitives.
65
+ * https://github.com/ng-primitives/ng-primitives
66
+ *
67
+ * This source code is licensed under the CC BY-ND 4.0 license found in the
68
+ * LICENSE file in the root directory of this source tree.
69
+ */
70
+
71
+ /**
72
+ * Generated bundle index. Do not edit.
73
+ */
74
+
75
+ export { NgpSearchField, NgpSearchFieldToken };
76
+ //# sourceMappingURL=ng-primitives-search.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ng-primitives-search.mjs","sources":["../../../../packages/ng-primitives/search/src/search-field/search-field.token.ts","../../../../packages/ng-primitives/search/src/search-field/search-field.directive.ts","../../../../packages/ng-primitives/search/src/index.ts","../../../../packages/ng-primitives/search/src/ng-primitives-search.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 { NgpSearchField } from './search-field.directive';\n\nexport const NgpSearchFieldToken = new InjectionToken<NgpSearchField>('NgpSearchFieldToken');\n\n/**\n * Inject the SearchField directive instance\n */\nexport function injectSearchField(): NgpSearchField {\n return inject(NgpSearchFieldToken);\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 { computed, contentChild, Directive, HostListener } from '@angular/core';\nimport { NgpFormField } from 'ng-primitives/form-field';\nimport { NgpInputToken } from 'ng-primitives/input';\nimport { NgpSearchFieldToken } from './search-field.token';\n\n@Directive({\n standalone: true,\n selector: '[ngpSearchField]',\n exportAs: 'ngpSearchField',\n providers: [{ provide: NgpSearchFieldToken, useExisting: NgpSearchField }],\n hostDirectives: [NgpFormField],\n host: {\n '[attr.data-empty]': 'empty()',\n },\n})\nexport class NgpSearchField {\n /**\n * Access the child input field.\n */\n protected readonly input = contentChild.required(NgpInputToken, { descendants: true });\n\n /**\n * Whether the input field is empty.\n */\n protected readonly empty = computed(() => this.input().value() === '');\n\n @HostListener('keydown.escape')\n protected clear(): void {\n this.input().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 { NgpSearchField } from './search-field/search-field.directive';\nexport { NgpSearchFieldToken } from './search-field/search-field.token';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;AAAA;;;;;;AAMG;MAIU,mBAAmB,GAAG,IAAI,cAAc,CAAiB,qBAAqB,EAAE;AAE7F;;AAEG;SACa,iBAAiB,GAAA;AAC/B,IAAA,OAAO,MAAM,CAAC,mBAAmB,CAAC,CAAC;AACrC;;ACjBA;;;;;;AAMG;MAgBU,cAAc,CAAA;AAV3B,IAAA,WAAA,GAAA;AAWE;;AAEG;AACgB,QAAA,IAAA,CAAA,KAAK,GAAG,YAAY,CAAC,QAAQ,CAAC,aAAa,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC;AAEvF;;AAEG;AACgB,QAAA,IAAA,CAAA,KAAK,GAAG,QAAQ,CAAC,MAAM,IAAI,CAAC,KAAK,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;AAMxE,KAAA;IAHW,KAAK,GAAA;QACb,IAAI,CAAC,KAAK,EAAE,CAAC,OAAO,CAAC,aAAa,CAAC,KAAK,GAAG,EAAE,CAAC;KAC/C;8GAdU,cAAc,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA,EAAA;AAAd,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA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