ng-primitives 0.34.0 → 0.36.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (226) hide show
  1. package/a11y/index.d.ts +1 -1
  2. package/a11y/visually-hidden/visually-hidden-state.d.ts +52 -0
  3. package/a11y/visually-hidden/visually-hidden.d.ts +1 -0
  4. package/accordion/accordion/accordion-state.d.ts +1 -1
  5. package/accordion/accordion-item/accordion-item-state.d.ts +1 -1
  6. package/avatar/avatar/avatar-state.d.ts +1 -1
  7. package/avatar/avatar-image/avatar-image.d.ts +36 -1
  8. package/button/button/button-state.d.ts +12 -2
  9. package/button/button/button.d.ts +1 -2
  10. package/button/index.d.ts +1 -1
  11. package/checkbox/checkbox/checkbox-state.d.ts +1 -1
  12. package/checkbox/checkbox/checkbox.d.ts +3 -4
  13. package/date-picker/date-picker/date-picker-state.d.ts +1 -1
  14. package/date-picker/date-picker-date-button/date-picker-date-button.d.ts +1 -2
  15. package/date-picker/date-picker-next-month/date-picker-next-month.d.ts +2 -2
  16. package/date-picker/date-picker-previous-month/date-picker-previous-month.d.ts +2 -2
  17. package/date-picker/index.d.ts +5 -9
  18. package/dialog/dialog/dialog-state.d.ts +1 -1
  19. package/dialog/index.d.ts +0 -4
  20. package/fesm2022/ng-primitives-a11y.mjs +20 -9
  21. package/fesm2022/ng-primitives-a11y.mjs.map +1 -1
  22. package/fesm2022/ng-primitives-avatar.mjs +3 -3
  23. package/fesm2022/ng-primitives-avatar.mjs.map +1 -1
  24. package/fesm2022/ng-primitives-button.mjs +18 -5
  25. package/fesm2022/ng-primitives-button.mjs.map +1 -1
  26. package/fesm2022/ng-primitives-checkbox.mjs +13 -8
  27. package/fesm2022/ng-primitives-checkbox.mjs.map +1 -1
  28. package/fesm2022/ng-primitives-date-picker.mjs +13 -65
  29. package/fesm2022/ng-primitives-date-picker.mjs.map +1 -1
  30. package/fesm2022/ng-primitives-dialog.mjs +5 -41
  31. package/fesm2022/ng-primitives-dialog.mjs.map +1 -1
  32. package/fesm2022/ng-primitives-file-upload.mjs +12 -5
  33. package/fesm2022/ng-primitives-file-upload.mjs.map +1 -1
  34. package/fesm2022/ng-primitives-focus-trap.mjs +3 -12
  35. package/fesm2022/ng-primitives-focus-trap.mjs.map +1 -1
  36. package/fesm2022/ng-primitives-form-field.mjs +103 -93
  37. package/fesm2022/ng-primitives-form-field.mjs.map +1 -1
  38. package/fesm2022/ng-primitives-input.mjs +34 -21
  39. package/fesm2022/ng-primitives-input.mjs.map +1 -1
  40. package/fesm2022/ng-primitives-interactions.mjs +14 -80
  41. package/fesm2022/ng-primitives-interactions.mjs.map +1 -1
  42. package/fesm2022/ng-primitives-internal.mjs +93 -65
  43. package/fesm2022/ng-primitives-internal.mjs.map +1 -1
  44. package/fesm2022/ng-primitives-listbox.mjs +19 -48
  45. package/fesm2022/ng-primitives-listbox.mjs.map +1 -1
  46. package/fesm2022/ng-primitives-menu.mjs +1 -5
  47. package/fesm2022/ng-primitives-menu.mjs.map +1 -1
  48. package/fesm2022/ng-primitives-pagination.mjs +53 -147
  49. package/fesm2022/ng-primitives-pagination.mjs.map +1 -1
  50. package/fesm2022/ng-primitives-popover.mjs +105 -96
  51. package/fesm2022/ng-primitives-popover.mjs.map +1 -1
  52. package/fesm2022/ng-primitives-progress.mjs +4 -18
  53. package/fesm2022/ng-primitives-progress.mjs.map +1 -1
  54. package/fesm2022/ng-primitives-radio.mjs +9 -5
  55. package/fesm2022/ng-primitives-radio.mjs.map +1 -1
  56. package/fesm2022/ng-primitives-roving-focus.mjs +2 -12
  57. package/fesm2022/ng-primitives-roving-focus.mjs.map +1 -1
  58. package/fesm2022/ng-primitives-select.mjs +35 -21
  59. package/fesm2022/ng-primitives-select.mjs.map +1 -1
  60. package/fesm2022/ng-primitives-separator.mjs +2 -11
  61. package/fesm2022/ng-primitives-separator.mjs.map +1 -1
  62. package/fesm2022/ng-primitives-slider.mjs +62 -120
  63. package/fesm2022/ng-primitives-slider.mjs.map +1 -1
  64. package/fesm2022/ng-primitives-state.mjs +10 -3
  65. package/fesm2022/ng-primitives-state.mjs.map +1 -1
  66. package/fesm2022/ng-primitives-switch.mjs +22 -35
  67. package/fesm2022/ng-primitives-switch.mjs.map +1 -1
  68. package/fesm2022/ng-primitives-tabs.mjs +17 -22
  69. package/fesm2022/ng-primitives-tabs.mjs.map +1 -1
  70. package/fesm2022/ng-primitives-textarea.mjs +34 -21
  71. package/fesm2022/ng-primitives-textarea.mjs.map +1 -1
  72. package/fesm2022/ng-primitives-toast.mjs +27 -16
  73. package/fesm2022/ng-primitives-toast.mjs.map +1 -1
  74. package/fesm2022/ng-primitives-toggle-group.mjs +26 -49
  75. package/fesm2022/ng-primitives-toggle-group.mjs.map +1 -1
  76. package/fesm2022/ng-primitives-toggle.mjs +4 -18
  77. package/fesm2022/ng-primitives-toggle.mjs.map +1 -1
  78. package/fesm2022/ng-primitives-toolbar.mjs +3 -18
  79. package/fesm2022/ng-primitives-toolbar.mjs.map +1 -1
  80. package/fesm2022/ng-primitives-tooltip.mjs +103 -82
  81. package/fesm2022/ng-primitives-tooltip.mjs.map +1 -1
  82. package/fesm2022/ng-primitives-utils.mjs +18 -0
  83. package/fesm2022/ng-primitives-utils.mjs.map +1 -1
  84. package/file-upload/file-dropzone/file-dropzone-state.d.ts +2 -2
  85. package/file-upload/file-dropzone/file-dropzone.d.ts +3 -2
  86. package/file-upload/file-upload/file-upload-state.d.ts +2 -2
  87. package/file-upload/file-upload/file-upload.d.ts +3 -2
  88. package/focus-trap/index.d.ts +0 -1
  89. package/form-field/description/description.d.ts +25 -1
  90. package/form-field/error/error.d.ts +25 -1
  91. package/form-field/form-control/form-control-state.d.ts +58 -0
  92. package/form-field/form-control/form-control.d.ts +36 -7
  93. package/form-field/form-field/form-field-state.d.ts +41 -0
  94. package/form-field/form-field/form-field.d.ts +4 -0
  95. package/form-field/index.d.ts +2 -5
  96. package/form-field/label/label.d.ts +26 -2
  97. package/input/index.d.ts +1 -1
  98. package/input/input/input-state.d.ts +30 -0
  99. package/input/input/input.d.ts +7 -5
  100. package/interactions/focus/focus.d.ts +0 -4
  101. package/interactions/focus-visible/focus-visible.d.ts +0 -4
  102. package/interactions/hover/hover.d.ts +0 -4
  103. package/interactions/index.d.ts +0 -5
  104. package/interactions/move/move.d.ts +0 -4
  105. package/interactions/press/press.d.ts +0 -4
  106. package/internal/exit-animation/exit-animation-manager.d.ts +17 -0
  107. package/internal/exit-animation/exit-animation.d.ts +4 -17
  108. package/internal/index.d.ts +3 -2
  109. package/internal/interactions/interactions.d.ts +5 -1
  110. package/internal/signals/sync-state.d.ts +2 -0
  111. package/listbox/index.d.ts +0 -4
  112. package/listbox/listbox/listbox-state.d.ts +2 -2
  113. package/package.json +9 -9
  114. package/pagination/index.d.ts +0 -6
  115. package/pagination/pagination/pagination-state.d.ts +2 -2
  116. package/pagination/pagination/pagination.d.ts +5 -5
  117. package/pagination/pagination-button/pagination-button.d.ts +4 -8
  118. package/pagination/pagination-first/pagination-first.d.ts +4 -8
  119. package/pagination/pagination-last/pagination-last.d.ts +3 -7
  120. package/pagination/pagination-next/pagination-next.d.ts +4 -8
  121. package/pagination/pagination-previous/pagination-previous.d.ts +4 -8
  122. package/popover/index.d.ts +1 -2
  123. package/popover/popover/popover-token.d.ts +8 -5
  124. package/popover/popover/popover.d.ts +3 -2
  125. package/popover/popover-trigger/popover-trigger-state.d.ts +5 -3
  126. package/popover/popover-trigger/popover-trigger.d.ts +27 -19
  127. package/progress/index.d.ts +0 -1
  128. package/progress/progress/progress-state.d.ts +1 -1
  129. package/radio/radio-group/radio-group-state.d.ts +1 -1
  130. package/radio/radio-group/radio-group.d.ts +2 -2
  131. package/radio/radio-item/radio-item-state.d.ts +1 -1
  132. package/roving-focus/index.d.ts +2 -3
  133. package/roving-focus/roving-focus-group/roving-focus-group-state.d.ts +1 -1
  134. package/schematics/ng-generate/schema.d.ts +4 -1
  135. package/schematics/ng-generate/schema.json +4 -1
  136. package/schematics/ng-generate/templates/toast/toast.__fileSuffix@dasherize__.ts.template +111 -0
  137. package/schematics/ng-generate/templates/toolbar/toolbar-button.__fileSuffix@dasherize__.ts.template +58 -0
  138. package/schematics/ng-generate/templates/toolbar/toolbar.__fileSuffix@dasherize__.ts.template +29 -0
  139. package/schematics/ng-generate/templates/tooltip/tooltip-trigger.__fileSuffix@dasherize__.ts.template +35 -0
  140. package/schematics/ng-generate/templates/tooltip/tooltip.__fileSuffix@dasherize__.ts.template +60 -0
  141. package/search/search/search-state.d.ts +1 -1
  142. package/select/index.d.ts +1 -1
  143. package/select/select/select-state.d.ts +20 -0
  144. package/select/select/select.d.ts +7 -4
  145. package/separator/index.d.ts +1 -2
  146. package/slider/index.d.ts +0 -4
  147. package/slider/slider/slider-state.d.ts +1 -1
  148. package/slider/slider/slider.d.ts +2 -2
  149. package/slider/slider-range/slider-range.d.ts +1 -1
  150. package/slider/slider-thumb/slider-thumb.d.ts +3 -7
  151. package/slider/slider-track/slider-track.d.ts +1 -5
  152. package/state/index.d.ts +7 -1
  153. package/switch/index.d.ts +0 -1
  154. package/switch/switch/switch-state.d.ts +1 -1
  155. package/switch/switch/switch.d.ts +3 -4
  156. package/switch/switch-thumb/switch-thumb.d.ts +2 -2
  157. package/tabs/index.d.ts +1 -2
  158. package/tabs/tab-button/tab-button.d.ts +2 -2
  159. package/tabs/tabset/tabset-state.d.ts +1 -1
  160. package/textarea/index.d.ts +1 -1
  161. package/textarea/textarea/textarea-state.d.ts +20 -0
  162. package/textarea/textarea/textarea.d.ts +7 -4
  163. package/toast/index.d.ts +0 -1
  164. package/toast/toast/toast.d.ts +21 -1
  165. package/toggle/index.d.ts +0 -1
  166. package/toggle/toggle/toggle-state.d.ts +1 -1
  167. package/toggle-group/index.d.ts +0 -2
  168. package/toggle-group/toggle-group/toggle-group-state.d.ts +1 -1
  169. package/toggle-group/toggle-group-item/toggle-group-item-state.d.ts +15 -2
  170. package/toggle-group/toggle-group-item/toggle-group-item.d.ts +1 -1
  171. package/toolbar/index.d.ts +0 -1
  172. package/tooltip/index.d.ts +1 -2
  173. package/tooltip/tooltip/tooltip-token.d.ts +8 -5
  174. package/tooltip/tooltip/tooltip.d.ts +2 -1
  175. package/tooltip/tooltip-trigger/tooltip-trigger-state.d.ts +3 -3
  176. package/tooltip/tooltip-trigger/tooltip-trigger.d.ts +43 -22
  177. package/a11y/visually-hidden/visually-hidden-token.d.ts +0 -7
  178. package/date-picker/date-picker-cell/date-picker-cell-token.d.ts +0 -7
  179. package/date-picker/date-picker-grid/date-picker-grid-token.d.ts +0 -7
  180. package/date-picker/date-picker-next-month/date-picker-next-month-token.d.ts +0 -7
  181. package/date-picker/date-picker-previous-month/date-picker-previous-month-token.d.ts +0 -7
  182. package/dialog/dialog-description/dialog-description-token.d.ts +0 -7
  183. package/dialog/dialog-overlay/dialog-overlay-token.d.ts +0 -7
  184. package/dialog/dialog-title/dialog-title-token.d.ts +0 -7
  185. package/dialog/dialog-trigger/dialog-trigger-token.d.ts +0 -7
  186. package/focus-trap/focus-trap/focus-trap-token.d.ts +0 -7
  187. package/form-field/description/description-token.d.ts +0 -7
  188. package/form-field/error/error-token.d.ts +0 -7
  189. package/form-field/form-control/form-control-token.d.ts +0 -7
  190. package/form-field/form-field/form-field-token.d.ts +0 -8
  191. package/form-field/label/label-token.d.ts +0 -7
  192. package/input/input/input-token.d.ts +0 -7
  193. package/interactions/focus/focus-token.d.ts +0 -7
  194. package/interactions/focus-visible/focus-visible-token.d.ts +0 -7
  195. package/interactions/hover/hover-token.d.ts +0 -8
  196. package/interactions/move/move-token.d.ts +0 -7
  197. package/interactions/press/press-token.d.ts +0 -7
  198. package/internal/disabled/disabled.d.ts +0 -14
  199. package/listbox/listbox/listbox-token.d.ts +0 -7
  200. package/listbox/listbox-option/listbox-option-token.d.ts +0 -7
  201. package/listbox/listbox-section/listbox-section-token.d.ts +0 -7
  202. package/listbox/listbox-trigger/listbox-trigger-token.d.ts +0 -7
  203. package/pagination/pagination/pagination-token.d.ts +0 -8
  204. package/pagination/pagination-button/pagination-button-token.d.ts +0 -7
  205. package/pagination/pagination-first/pagination-first-token.d.ts +0 -7
  206. package/pagination/pagination-last/pagination-last-token.d.ts +0 -7
  207. package/pagination/pagination-next/pagination-next-token.d.ts +0 -7
  208. package/pagination/pagination-previous/pagination-previous-token.d.ts +0 -7
  209. package/popover/popover-trigger/popover-trigger-token.d.ts +0 -12
  210. package/progress/progress/progress-token.d.ts +0 -11
  211. package/roving-focus/roving-focus-item/roving-focus-item-token.d.ts +0 -8
  212. package/select/select/select-token.d.ts +0 -7
  213. package/separator/separator/separator-token.d.ts +0 -7
  214. package/slider/slider/slider-token.d.ts +0 -8
  215. package/slider/slider-range/slider-range-token.d.ts +0 -8
  216. package/slider/slider-thumb/slider-thumb-token.d.ts +0 -8
  217. package/slider/slider-track/slider-track-token.d.ts +0 -8
  218. package/switch/switch/switch-token.d.ts +0 -11
  219. package/tabs/tabset/tabset-token.d.ts +0 -11
  220. package/textarea/textarea/textarea-token.d.ts +0 -7
  221. package/toast/toast/toast-token.d.ts +0 -7
  222. package/toggle/toggle/toggle-token.d.ts +0 -11
  223. package/toggle-group/toggle-group/toggle-group-token.d.ts +0 -11
  224. package/toggle-group/toggle-group-item/toggle-group-item-token.d.ts +0 -11
  225. package/toolbar/toolbar/toolbar-token.d.ts +0 -11
  226. package/tooltip/tooltip-trigger/tooltip-trigger-token.d.ts +0 -15
@@ -1,10 +1,8 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { input, booleanAttribute, output, Directive, HostListener } from '@angular/core';
3
3
  import * as i1 from 'ng-primitives/form-field';
4
- import { NgpFormControl } from 'ng-primitives/form-field';
5
- import * as i2 from 'ng-primitives/interactions';
6
- import { NgpHover, NgpFocusVisible, NgpPress } from 'ng-primitives/interactions';
7
- import { NgpDisabledToken } from 'ng-primitives/internal';
4
+ import { syncFormControl, NgpFormControl } from 'ng-primitives/form-field';
5
+ import { setupInteractions } from 'ng-primitives/internal';
8
6
  import { uniqueId } from 'ng-primitives/utils';
9
7
  import { createStateToken, createStateProvider, createStateInjector, createState } from 'ng-primitives/state';
10
8
 
@@ -79,6 +77,13 @@ class NgpCheckbox {
79
77
  * The state of the checkbox.
80
78
  */
81
79
  this.state = checkboxState(this);
80
+ syncFormControl({ disabled: this.state.disabled });
81
+ setupInteractions({
82
+ hover: true,
83
+ press: true,
84
+ focusVisible: true,
85
+ disabled: this.state.disabled,
86
+ });
82
87
  }
83
88
  onEnter(event) {
84
89
  // According to WAI ARIA, Checkboxes don't activate on enter keypress
@@ -99,14 +104,14 @@ class NgpCheckbox {
99
104
  }
100
105
  }
101
106
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: NgpCheckbox, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
102
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.0.7", type: NgpCheckbox, isStandalone: true, selector: "[ngpCheckbox]", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, checked: { classPropertyName: "checked", publicName: "ngpCheckboxChecked", isSignal: true, isRequired: false, transformFunction: null }, indeterminate: { classPropertyName: "indeterminate", publicName: "ngpCheckboxIndeterminate", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "ngpCheckboxRequired", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "ngpCheckboxDisabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { checkedChange: "ngpCheckboxCheckedChange", indeterminateChange: "ngpCheckboxIndeterminateChange" }, host: { attributes: { "role": "checkbox" }, listeners: { "keydown.enter": "onEnter($event)", "click": "toggle($event)", "keydown.space": "toggle($event)" }, properties: { "attr.aria-checked": "state.indeterminate() ? \"mixed\" : state.checked()", "attr.data-checked": "state.checked() ? \"\" : null", "attr.data-indeterminate": "state.indeterminate() ? \"\" : null", "attr.aria-disabled": "state.disabled()", "tabindex": "state.disabled() ? -1 : 0" } }, providers: [provideCheckboxState(), { provide: NgpDisabledToken, useExisting: NgpCheckbox }], hostDirectives: [{ directive: i1.NgpFormControl }, { directive: i2.NgpHover }, { directive: i2.NgpFocusVisible }, { directive: i2.NgpPress }], ngImport: i0 }); }
107
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.0.7", type: NgpCheckbox, isStandalone: true, selector: "[ngpCheckbox]", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, checked: { classPropertyName: "checked", publicName: "ngpCheckboxChecked", isSignal: true, isRequired: false, transformFunction: null }, indeterminate: { classPropertyName: "indeterminate", publicName: "ngpCheckboxIndeterminate", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "ngpCheckboxRequired", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "ngpCheckboxDisabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { checkedChange: "ngpCheckboxCheckedChange", indeterminateChange: "ngpCheckboxIndeterminateChange" }, host: { attributes: { "role": "checkbox" }, listeners: { "keydown.enter": "onEnter($event)", "click": "toggle($event)", "keydown.space": "toggle($event)" }, properties: { "attr.aria-checked": "state.indeterminate() ? \"mixed\" : state.checked()", "attr.data-checked": "state.checked() ? \"\" : null", "attr.data-indeterminate": "state.indeterminate() ? \"\" : null", "attr.aria-disabled": "state.disabled()", "tabindex": "state.disabled() ? -1 : 0" } }, providers: [provideCheckboxState()], hostDirectives: [{ directive: i1.NgpFormControl }], ngImport: i0 }); }
103
108
  }
104
109
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: NgpCheckbox, decorators: [{
105
110
  type: Directive,
106
111
  args: [{
107
112
  selector: '[ngpCheckbox]',
108
- providers: [provideCheckboxState(), { provide: NgpDisabledToken, useExisting: NgpCheckbox }],
109
- hostDirectives: [NgpFormControl, NgpHover, NgpFocusVisible, NgpPress],
113
+ providers: [provideCheckboxState()],
114
+ hostDirectives: [NgpFormControl],
110
115
  host: {
111
116
  role: 'checkbox',
112
117
  '[attr.aria-checked]': 'state.indeterminate() ? "mixed" : state.checked()',
@@ -116,7 +121,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.7", ngImpor
116
121
  '[tabindex]': 'state.disabled() ? -1 : 0',
117
122
  },
118
123
  }]
119
- }], propDecorators: { onEnter: [{
124
+ }], ctorParameters: () => [], propDecorators: { onEnter: [{
120
125
  type: HostListener,
121
126
  args: ['keydown.enter', ['$event']]
122
127
  }], toggle: [{
@@ -1 +1 @@
1
- {"version":3,"file":"ng-primitives-checkbox.mjs","sources":["../../../../packages/ng-primitives/checkbox/src/checkbox/checkbox-state.ts","../../../../packages/ng-primitives/checkbox/src/checkbox/checkbox.ts","../../../../packages/ng-primitives/checkbox/src/ng-primitives-checkbox.ts"],"sourcesContent":["import {\n createState,\n createStateInjector,\n createStateProvider,\n createStateToken,\n} from 'ng-primitives/state';\nimport type { NgpCheckbox } from './checkbox';\n\n/**\n * The state token for the Checkbox primitive.\n */\nexport const NgpCheckboxStateToken = createStateToken<NgpCheckbox>('Checkbox');\n\n/**\n * Provides the Checkbox state.\n */\nexport const provideCheckboxState = createStateProvider(NgpCheckboxStateToken);\n\n/**\n * Injects the Checkbox state.\n */\nexport const injectCheckboxState = createStateInjector(NgpCheckboxStateToken);\n\n/**\n * The Checkbox state registration function.\n */\nexport const checkboxState = createState(NgpCheckboxStateToken);\n","import { BooleanInput } from '@angular/cdk/coercion';\nimport { Directive, HostListener, booleanAttribute, input, output } from '@angular/core';\nimport { NgpFormControl } from 'ng-primitives/form-field';\nimport { NgpFocusVisible, NgpHover, NgpPress } from 'ng-primitives/interactions';\nimport { NgpCanDisable, NgpDisabledToken } from 'ng-primitives/internal';\nimport { uniqueId } from 'ng-primitives/utils';\nimport { checkboxState, provideCheckboxState } from './checkbox-state';\n\n/**\n * Apply the `ngpCheckbox` directive to an element to that represents the checkbox, such as a `button`.\n */\n@Directive({\n selector: '[ngpCheckbox]',\n providers: [provideCheckboxState(), { provide: NgpDisabledToken, useExisting: NgpCheckbox }],\n hostDirectives: [NgpFormControl, NgpHover, NgpFocusVisible, NgpPress],\n host: {\n role: 'checkbox',\n '[attr.aria-checked]': 'state.indeterminate() ? \"mixed\" : state.checked()',\n '[attr.data-checked]': 'state.checked() ? \"\" : null',\n '[attr.data-indeterminate]': 'state.indeterminate() ? \"\" : null',\n '[attr.aria-disabled]': 'state.disabled()',\n '[tabindex]': 'state.disabled() ? -1 : 0',\n },\n})\nexport class NgpCheckbox implements NgpCanDisable {\n /**\n * The id of the checkbox.\n * @internal\n */\n readonly id = input(uniqueId('ngp-checkbox'));\n\n /**\n * Defines whether the checkbox is checked.\n */\n readonly checked = input<boolean, BooleanInput>(false, {\n alias: 'ngpCheckboxChecked',\n transform: booleanAttribute,\n });\n\n /**\n * The event that is emitted when the checkbox value changes.\n */\n readonly checkedChange = output<boolean>({\n alias: 'ngpCheckboxCheckedChange',\n });\n\n /**\n * Defines whether the checkbox is indeterminate.\n */\n readonly indeterminate = input<boolean, BooleanInput>(false, {\n alias: 'ngpCheckboxIndeterminate',\n transform: booleanAttribute,\n });\n\n /**\n * The event that is emitted when the indeterminate value changes.\n */\n readonly indeterminateChange = output<boolean>({\n alias: 'ngpCheckboxIndeterminateChange',\n });\n\n /**\n * Whether the checkbox is required.\n */\n readonly required = input<boolean, BooleanInput>(false, {\n alias: 'ngpCheckboxRequired',\n transform: booleanAttribute,\n });\n\n /**\n * Defines whether the checkbox is disabled.\n */\n readonly disabled = input<boolean, BooleanInput>(false, {\n alias: 'ngpCheckboxDisabled',\n transform: booleanAttribute,\n });\n\n /**\n * The state of the checkbox.\n */\n protected readonly state = checkboxState<NgpCheckbox>(this);\n\n @HostListener('keydown.enter', ['$event'])\n protected onEnter(event: KeyboardEvent): void {\n // According to WAI ARIA, Checkboxes don't activate on enter keypress\n event.preventDefault();\n }\n\n @HostListener('click', ['$event'])\n @HostListener('keydown.space', ['$event'])\n toggle(event?: Event): void {\n if (this.state.disabled()) {\n return;\n }\n\n // prevent this firing twice in cases where the label is clicked and the checkbox is clicked by the one event\n event?.preventDefault();\n\n this.state.checked.set(this.state.indeterminate() ? true : !this.state.checked());\n this.checkedChange.emit(this.state.checked());\n\n // if the checkbox was indeterminate, it isn't anymore\n if (this.state.indeterminate()) {\n this.state.indeterminate.set(false);\n this.indeterminateChange.emit(false);\n }\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;AAQA;;AAEG;AACI,MAAM,qBAAqB,GAAG,gBAAgB,CAAc,UAAU,CAAC;AAE9E;;AAEG;MACU,oBAAoB,GAAG,mBAAmB,CAAC,qBAAqB;AAE7E;;AAEG;MACU,mBAAmB,GAAG,mBAAmB,CAAC,qBAAqB;AAE5E;;AAEG;AACI,MAAM,aAAa,GAAG,WAAW,CAAC,qBAAqB,CAAC;;AClB/D;;AAEG;MAcU,WAAW,CAAA;AAbxB,IAAA,WAAA,GAAA;AAcE;;;AAGG;QACM,IAAE,CAAA,EAAA,GAAG,KAAK,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC;AAE7C;;AAEG;AACM,QAAA,IAAA,CAAA,OAAO,GAAG,KAAK,CAAwB,KAAK,EAAE;AACrD,YAAA,KAAK,EAAE,oBAAoB;AAC3B,YAAA,SAAS,EAAE,gBAAgB;AAC5B,SAAA,CAAC;AAEF;;AAEG;QACM,IAAa,CAAA,aAAA,GAAG,MAAM,CAAU;AACvC,YAAA,KAAK,EAAE,0BAA0B;AAClC,SAAA,CAAC;AAEF;;AAEG;AACM,QAAA,IAAA,CAAA,aAAa,GAAG,KAAK,CAAwB,KAAK,EAAE;AAC3D,YAAA,KAAK,EAAE,0BAA0B;AACjC,YAAA,SAAS,EAAE,gBAAgB;AAC5B,SAAA,CAAC;AAEF;;AAEG;QACM,IAAmB,CAAA,mBAAA,G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BAAC,eAAe,EAAE,CAAC,QAAQ,CAAC;;;ACzF3C;;AAEG;;;;"}
1
+ {"version":3,"file":"ng-primitives-checkbox.mjs","sources":["../../../../packages/ng-primitives/checkbox/src/checkbox/checkbox-state.ts","../../../../packages/ng-primitives/checkbox/src/checkbox/checkbox.ts","../../../../packages/ng-primitives/checkbox/src/ng-primitives-checkbox.ts"],"sourcesContent":["import {\n createState,\n createStateInjector,\n createStateProvider,\n createStateToken,\n} from 'ng-primitives/state';\nimport type { NgpCheckbox } from './checkbox';\n\n/**\n * The state token for the Checkbox primitive.\n */\nexport const NgpCheckboxStateToken = createStateToken<NgpCheckbox>('Checkbox');\n\n/**\n * Provides the Checkbox state.\n */\nexport const provideCheckboxState = createStateProvider(NgpCheckboxStateToken);\n\n/**\n * Injects the Checkbox state.\n */\nexport const injectCheckboxState = createStateInjector(NgpCheckboxStateToken);\n\n/**\n * The Checkbox state registration function.\n */\nexport const checkboxState = createState(NgpCheckboxStateToken);\n","import { BooleanInput } from '@angular/cdk/coercion';\nimport { Directive, HostListener, booleanAttribute, input, output } from '@angular/core';\nimport { NgpFormControl, syncFormControl } from 'ng-primitives/form-field';\nimport { setupInteractions } from 'ng-primitives/internal';\nimport { uniqueId } from 'ng-primitives/utils';\nimport { checkboxState, provideCheckboxState } from './checkbox-state';\n\n/**\n * Apply the `ngpCheckbox` directive to an element to that represents the checkbox, such as a `button`.\n */\n@Directive({\n selector: '[ngpCheckbox]',\n providers: [provideCheckboxState()],\n hostDirectives: [NgpFormControl],\n host: {\n role: 'checkbox',\n '[attr.aria-checked]': 'state.indeterminate() ? \"mixed\" : state.checked()',\n '[attr.data-checked]': 'state.checked() ? \"\" : null',\n '[attr.data-indeterminate]': 'state.indeterminate() ? \"\" : null',\n '[attr.aria-disabled]': 'state.disabled()',\n '[tabindex]': 'state.disabled() ? -1 : 0',\n },\n})\nexport class NgpCheckbox {\n /**\n * The id of the checkbox.\n * @internal\n */\n readonly id = input(uniqueId('ngp-checkbox'));\n\n /**\n * Defines whether the checkbox is checked.\n */\n readonly checked = input<boolean, BooleanInput>(false, {\n alias: 'ngpCheckboxChecked',\n transform: booleanAttribute,\n });\n\n /**\n * The event that is emitted when the checkbox value changes.\n */\n readonly checkedChange = output<boolean>({\n alias: 'ngpCheckboxCheckedChange',\n });\n\n /**\n * Defines whether the checkbox is indeterminate.\n */\n readonly indeterminate = input<boolean, BooleanInput>(false, {\n alias: 'ngpCheckboxIndeterminate',\n transform: booleanAttribute,\n });\n\n /**\n * The event that is emitted when the indeterminate value changes.\n */\n readonly indeterminateChange = output<boolean>({\n alias: 'ngpCheckboxIndeterminateChange',\n });\n\n /**\n * Whether the checkbox is required.\n */\n readonly required = input<boolean, BooleanInput>(false, {\n alias: 'ngpCheckboxRequired',\n transform: booleanAttribute,\n });\n\n /**\n * Defines whether the checkbox is disabled.\n */\n readonly disabled = input<boolean, BooleanInput>(false, {\n alias: 'ngpCheckboxDisabled',\n transform: booleanAttribute,\n });\n\n /**\n * The state of the checkbox.\n */\n protected readonly state = checkboxState<NgpCheckbox>(this);\n\n constructor() {\n syncFormControl({ disabled: this.state.disabled });\n setupInteractions({\n hover: true,\n press: true,\n focusVisible: true,\n disabled: this.state.disabled,\n });\n }\n\n @HostListener('keydown.enter', ['$event'])\n protected onEnter(event: KeyboardEvent): void {\n // According to WAI ARIA, Checkboxes don't activate on enter keypress\n event.preventDefault();\n }\n\n @HostListener('click', ['$event'])\n @HostListener('keydown.space', ['$event'])\n toggle(event?: Event): void {\n if (this.state.disabled()) {\n return;\n }\n\n // prevent this firing twice in cases where the label is clicked and the checkbox is clicked by the one event\n event?.preventDefault();\n\n this.state.checked.set(this.state.indeterminate() ? true : !this.state.checked());\n this.checkedChange.emit(this.state.checked());\n\n // if the checkbox was indeterminate, it isn't anymore\n if (this.state.indeterminate()) {\n this.state.indeterminate.set(false);\n this.indeterminateChange.emit(false);\n }\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings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,2BAAA,EAAA,EAAA,EAAA,SAAA,EAAA,CAAC,oBAAoB,EAAE,CAAC,EAAA,cAAA,EAAA,CAAA,EAAA,SAAA,EAAA,EAAA,CAAA,cAAA,EAAA,CAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA;;2FAWxB,WAAW,EAAA,UAAA,EAAA,CAAA;kBAbvB,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,eAAe;AACzB,oBAAA,SAAS,EAAE,CAAC,oBAAoB,EAAE,CAAC;oBACnC,cAAc,EAAE,CAAC,cAAc,CAAC;AAChC,oBAAA,IAAI,EAAE;AACJ,wBAAA,IAAI,EAAE,UAAU;AAChB,wBAAA,qBAAqB,EAAE,mDAAmD;AAC1E,wBAAA,qBAAqB,EAAE,6BAA6B;AACpD,wBAAA,2BAA2B,EAAE,mCAAmC;AAChE,wBAAA,sBAAsB,EAAE,kBAAkB;AAC1C,wBAAA,YAAY,EAAE,2BAA2B;AAC1C,qBAAA;AACF,iBAAA;wDAsEW,OAAO,EAAA,CAAA;sBADhB,YAAY;uBAAC,eAAe,EAAE,CAAC,QAAQ,CAAC;gBAQzC,MAAM,EAAA,CAAA;sBAFL,YAAY;uBAAC,OAAO,EAAE,CAAC,QAAQ,CAAC;;sBAChC,YAAY;uBAAC,eAAe,EAAE,CAAC,QAAQ,CAAC;;;AClG3C;;AAEG;;;;"}
@@ -2,9 +2,8 @@ import * as i0 from '@angular/core';
2
2
  import { InjectionToken, inject, TemplateRef, ViewContainerRef, Injector, Directive, contentChild, computed, ElementRef, HostListener, input, booleanAttribute, output, signal, afterNextRender } from '@angular/core';
3
3
  import { FocusMonitor } from '@angular/cdk/a11y';
4
4
  import * as i1 from 'ng-primitives/button';
5
- import { NgpButton } from 'ng-primitives/button';
5
+ import { syncButton, NgpButton } from 'ng-primitives/button';
6
6
  import { injectDateAdapter } from 'ng-primitives/date-time';
7
- import { NgpDisabledToken } from 'ng-primitives/internal';
8
7
  import { createStateToken, createStateProvider, createStateInjector, createState } from 'ng-primitives/state';
9
8
  import { uniqueId, onChange } from 'ng-primitives/utils';
10
9
 
@@ -123,14 +122,6 @@ function provideDatePicker(datePicker) {
123
122
  return { provide: NgpDatePickerToken, useExisting: datePicker };
124
123
  }
125
124
 
126
- const NgpDatePickerCellToken = new InjectionToken('NgpDatePickerCellToken');
127
- /**
128
- * Inject the DatePickerCell directive instance
129
- */
130
- function injectDatePickerCell() {
131
- return inject(NgpDatePickerCellToken);
132
- }
133
-
134
125
  /**
135
126
  * A cell in the date picker grid.
136
127
  */
@@ -152,14 +143,13 @@ class NgpDatePickerCell {
152
143
  this.labelId = computed(() => this.datePicker.label()?.id());
153
144
  }
154
145
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: NgpDatePickerCell, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
155
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "19.0.7", type: NgpDatePickerCell, isStandalone: true, selector: "[ngpDatePickerCell]", host: { attributes: { "role": "gridcell" }, properties: { "attr.data-selected": "datePickerButton()?.selected() ? \"\" : null", "attr.aria-selected": "datePickerButton()?.selected()", "attr.aria-disabled": "datePickerButton()?.disabled()", "attr.data-disabled": "datePickerButton()?.disabled() ? \"\" : null", "attr.aria-labelledby": "labelId()" } }, providers: [{ provide: NgpDatePickerCellToken, useExisting: NgpDatePickerCell }], queries: [{ propertyName: "datePickerButton", first: true, predicate: NgpDatePickerDateButtonToken, descendants: true, isSignal: true }], exportAs: ["ngpDatePickerCell"], ngImport: i0 }); }
146
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "19.0.7", type: NgpDatePickerCell, isStandalone: true, selector: "[ngpDatePickerCell]", host: { attributes: { "role": "gridcell" }, properties: { "attr.data-selected": "datePickerButton()?.selected() ? \"\" : null", "attr.aria-selected": "datePickerButton()?.selected()", "attr.aria-disabled": "datePickerButton()?.disabled()", "attr.data-disabled": "datePickerButton()?.disabled() ? \"\" : null", "attr.aria-labelledby": "labelId()" } }, queries: [{ propertyName: "datePickerButton", first: true, predicate: NgpDatePickerDateButtonToken, descendants: true, isSignal: true }], exportAs: ["ngpDatePickerCell"], ngImport: i0 }); }
156
147
  }
157
148
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: NgpDatePickerCell, decorators: [{
158
149
  type: Directive,
159
150
  args: [{
160
151
  selector: '[ngpDatePickerCell]',
161
152
  exportAs: 'ngpDatePickerCell',
162
- providers: [{ provide: NgpDatePickerCellToken, useExisting: NgpDatePickerCell }],
163
153
  host: {
164
154
  role: 'gridcell',
165
155
  '[attr.data-selected]': 'datePickerButton()?.selected() ? "" : null',
@@ -248,6 +238,7 @@ class NgpDatePickerDateButton {
248
238
  */
249
239
  this.isButton = this.elementRef.nativeElement.tagName === 'BUTTON';
250
240
  this.datePicker.registerButton(this);
241
+ syncButton({ disabled: this.disabled });
251
242
  }
252
243
  ngOnDestroy() {
253
244
  this.datePicker.unregisterButton(this);
@@ -387,20 +378,14 @@ class NgpDatePickerDateButton {
387
378
  return getComputedStyle(this.elementRef.nativeElement).direction === 'rtl' ? 'rtl' : 'ltr';
388
379
  }
389
380
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: NgpDatePickerDateButton, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
390
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.0.7", type: NgpDatePickerDateButton, isStandalone: true, selector: "[ngpDatePickerDateButton]", host: { listeners: { "click": "select()", "keydown.enter": "select($event)", "keydown.space": "select($event)", "keydown.arrowLeft": "focusPrevious($event)", "keydown.arrowRight": "focusNext($event)", "keydown.arrowUp": "focusAbove($event)", "keydown.arrowDown": "focusBelow($event)", "keydown.home": "focusFirst($event)", "keydown.end": "focusLast($event)", "keydown.pageUp": "focusPreviousMonth($event)", "keydown.pageDown": "focusNextMonth($event)" }, properties: { "attr.role": "!isButton ? \"button\" : null", "attr.tabindex": "focused() ? 0 : -1", "attr.data-selected": "selected() ? \"\" : null", "attr.data-disabled": "disabled() ? \"\" : null", "attr.aria-disabled": "disabled()", "attr.data-outside-month": "outside() ? \"\" : null", "attr.data-today": "today() ? \"\" : null" } }, providers: [
391
- { provide: NgpDatePickerDateButtonToken, useExisting: NgpDatePickerDateButton },
392
- { provide: NgpDisabledToken, useExisting: NgpDatePickerDateButton },
393
- ], exportAs: ["ngpDatePickerDateButton"], hostDirectives: [{ directive: i1.NgpButton }], ngImport: i0 }); }
381
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.0.7", type: NgpDatePickerDateButton, isStandalone: true, selector: "[ngpDatePickerDateButton]", host: { listeners: { "click": "select()", "keydown.enter": "select($event)", "keydown.space": "select($event)", "keydown.arrowLeft": "focusPrevious($event)", "keydown.arrowRight": "focusNext($event)", "keydown.arrowUp": "focusAbove($event)", "keydown.arrowDown": "focusBelow($event)", "keydown.home": "focusFirst($event)", "keydown.end": "focusLast($event)", "keydown.pageUp": "focusPreviousMonth($event)", "keydown.pageDown": "focusNextMonth($event)" }, properties: { "attr.role": "!isButton ? \"button\" : null", "attr.tabindex": "focused() ? 0 : -1", "attr.data-selected": "selected() ? \"\" : null", "attr.data-disabled": "disabled() ? \"\" : null", "attr.aria-disabled": "disabled()", "attr.data-outside-month": "outside() ? \"\" : null", "attr.data-today": "today() ? \"\" : null" } }, providers: [{ provide: NgpDatePickerDateButtonToken, useExisting: NgpDatePickerDateButton }], exportAs: ["ngpDatePickerDateButton"], hostDirectives: [{ directive: i1.NgpButton }], ngImport: i0 }); }
394
382
  }
395
383
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: NgpDatePickerDateButton, decorators: [{
396
384
  type: Directive,
397
385
  args: [{
398
386
  selector: '[ngpDatePickerDateButton]',
399
387
  exportAs: 'ngpDatePickerDateButton',
400
- providers: [
401
- { provide: NgpDatePickerDateButtonToken, useExisting: NgpDatePickerDateButton },
402
- { provide: NgpDisabledToken, useExisting: NgpDatePickerDateButton },
403
- ],
388
+ providers: [{ provide: NgpDatePickerDateButtonToken, useExisting: NgpDatePickerDateButton }],
404
389
  host: {
405
390
  '[attr.role]': '!isButton ? "button" : null',
406
391
  '[attr.tabindex]': 'focused() ? 0 : -1',
@@ -447,14 +432,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.7", ngImpor
447
432
  args: ['keydown.pageDown', ['$event']]
448
433
  }] } });
449
434
 
450
- const NgpDatePickerGridToken = new InjectionToken('NgpDatePickerGridToken');
451
- /**
452
- * Inject the DatePickerGrid directive instance
453
- */
454
- function injectDatePickerGrid() {
455
- return inject(NgpDatePickerGridToken);
456
- }
457
-
458
435
  /**
459
436
  * The grid that contains the days of the month.
460
437
  */
@@ -470,14 +447,13 @@ class NgpDatePickerGrid {
470
447
  this.labelId = computed(() => this.state().label()?.id());
471
448
  }
472
449
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: NgpDatePickerGrid, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
473
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.0.7", type: NgpDatePickerGrid, isStandalone: true, selector: "[ngpDatePickerGrid]", host: { attributes: { "role": "grid" }, properties: { "attr.aria-labelledby": "labelId()", "attr.data-disabled": "state().disabled() ? \"\" : null" } }, providers: [{ provide: NgpDatePickerGridToken, useExisting: NgpDatePickerGrid }], exportAs: ["ngpDatePickerGrid"], ngImport: i0 }); }
450
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.0.7", type: NgpDatePickerGrid, isStandalone: true, selector: "[ngpDatePickerGrid]", host: { attributes: { "role": "grid" }, properties: { "attr.aria-labelledby": "labelId()", "attr.data-disabled": "state().disabled() ? \"\" : null" } }, exportAs: ["ngpDatePickerGrid"], ngImport: i0 }); }
474
451
  }
475
452
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: NgpDatePickerGrid, decorators: [{
476
453
  type: Directive,
477
454
  args: [{
478
455
  selector: '[ngpDatePickerGrid]',
479
456
  exportAs: 'ngpDatePickerGrid',
480
- providers: [{ provide: NgpDatePickerGridToken, useExisting: NgpDatePickerGrid }],
481
457
  host: {
482
458
  role: 'grid',
483
459
  '[attr.aria-labelledby]': 'labelId()',
@@ -531,14 +507,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.7", ngImpor
531
507
  }]
532
508
  }] });
533
509
 
534
- const NgpDatePickerNextMonthToken = new InjectionToken('NgpDatePickerNextMonthToken');
535
- /**
536
- * Inject the DatePickerNextMonth directive instance
537
- */
538
- function injectDatePickerNextMonth() {
539
- return inject(NgpDatePickerNextMonthToken);
540
- }
541
-
542
510
  /**
543
511
  * A button that navigates to the next month.
544
512
  */
@@ -585,6 +553,7 @@ class NgpDatePickerNextMonth {
585
553
  }
586
554
  return false;
587
555
  });
556
+ syncButton({ disabled: this.disabled });
588
557
  }
589
558
  /**
590
559
  * Navigate to the next month.
@@ -606,20 +575,13 @@ class NgpDatePickerNextMonth {
606
575
  this.datePicker.setFocusedDate(date, 'mouse', 'forward');
607
576
  }
608
577
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: NgpDatePickerNextMonth, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
609
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.0.7", type: NgpDatePickerNextMonth, isStandalone: true, selector: "[ngpDatePickerNextMonth]", host: { listeners: { "click": "navigateToNextMonth()" }, properties: { "attr.data-disabled": "disabled() ? \"\" : null", "attr.aria-disabled": "disabled()", "attr.disabled": "isButton && disabled() ? true : null", "attr.type": "isButton ? \"button\" : null" } }, providers: [
610
- { provide: NgpDatePickerNextMonthToken, useExisting: NgpDatePickerNextMonth },
611
- { provide: NgpDisabledToken, useExisting: NgpDatePickerNextMonth },
612
- ], exportAs: ["ngpDatePickerNextMonth"], hostDirectives: [{ directive: i1.NgpButton }], ngImport: i0 }); }
578
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.0.7", type: NgpDatePickerNextMonth, isStandalone: true, selector: "[ngpDatePickerNextMonth]", host: { listeners: { "click": "navigateToNextMonth()" }, properties: { "attr.data-disabled": "disabled() ? \"\" : null", "attr.aria-disabled": "disabled()", "attr.disabled": "isButton && disabled() ? true : null", "attr.type": "isButton ? \"button\" : null" } }, exportAs: ["ngpDatePickerNextMonth"], hostDirectives: [{ directive: i1.NgpButton }], ngImport: i0 }); }
613
579
  }
614
580
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: NgpDatePickerNextMonth, decorators: [{
615
581
  type: Directive,
616
582
  args: [{
617
583
  selector: '[ngpDatePickerNextMonth]',
618
584
  exportAs: 'ngpDatePickerNextMonth',
619
- providers: [
620
- { provide: NgpDatePickerNextMonthToken, useExisting: NgpDatePickerNextMonth },
621
- { provide: NgpDisabledToken, useExisting: NgpDatePickerNextMonth },
622
- ],
623
585
  hostDirectives: [NgpButton],
624
586
  host: {
625
587
  '[attr.data-disabled]': 'disabled() ? "" : null',
@@ -628,19 +590,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.7", ngImpor
628
590
  '[attr.type]': 'isButton ? "button" : null',
629
591
  },
630
592
  }]
631
- }], propDecorators: { navigateToNextMonth: [{
593
+ }], ctorParameters: () => [], propDecorators: { navigateToNextMonth: [{
632
594
  type: HostListener,
633
595
  args: ['click']
634
596
  }] } });
635
597
 
636
- const NgpDatePickerPreviousMonthToken = new InjectionToken('NgpDatePickerPreviousMonthToken');
637
- /**
638
- * Inject the DatePickerPreviousMonth directive instance
639
- */
640
- function injectDatePickerPreviousMonth() {
641
- return inject(NgpDatePickerPreviousMonthToken);
642
- }
643
-
644
598
  /**
645
599
  * A button that navigates to the previous month.
646
600
  */
@@ -688,6 +642,7 @@ class NgpDatePickerPreviousMonth {
688
642
  }
689
643
  return false;
690
644
  });
645
+ syncButton({ disabled: this.disabled });
691
646
  }
692
647
  /**
693
648
  * Navigate to the previous month.
@@ -709,20 +664,13 @@ class NgpDatePickerPreviousMonth {
709
664
  this.datePicker.setFocusedDate(date, 'mouse', 'backward');
710
665
  }
711
666
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: NgpDatePickerPreviousMonth, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
712
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.0.7", type: NgpDatePickerPreviousMonth, isStandalone: true, selector: "[ngpDatePickerPreviousMonth]", host: { listeners: { "click": "navigateToPreviouMonth()" }, properties: { "attr.data-disabled": "disabled() ? \"\" : null", "attr.aria-disabled": "disabled()", "attr.disabled": "isButton && disabled() ? true : null", "attr.type": "isButton ? \"button\" : null" } }, providers: [
713
- { provide: NgpDatePickerPreviousMonthToken, useExisting: NgpDatePickerPreviousMonth },
714
- { provide: NgpDisabledToken, useExisting: NgpDatePickerPreviousMonth },
715
- ], exportAs: ["ngpDatePickerPreviousMonth"], hostDirectives: [{ directive: i1.NgpButton }], ngImport: i0 }); }
667
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.0.7", type: NgpDatePickerPreviousMonth, isStandalone: true, selector: "[ngpDatePickerPreviousMonth]", host: { listeners: { "click": "navigateToPreviouMonth()" }, properties: { "attr.data-disabled": "disabled() ? \"\" : null", "attr.aria-disabled": "disabled()", "attr.disabled": "isButton && disabled() ? true : null", "attr.type": "isButton ? \"button\" : null" } }, exportAs: ["ngpDatePickerPreviousMonth"], hostDirectives: [{ directive: i1.NgpButton }], ngImport: i0 }); }
716
668
  }
717
669
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: NgpDatePickerPreviousMonth, decorators: [{
718
670
  type: Directive,
719
671
  args: [{
720
672
  selector: '[ngpDatePickerPreviousMonth]',
721
673
  exportAs: 'ngpDatePickerPreviousMonth',
722
- providers: [
723
- { provide: NgpDatePickerPreviousMonthToken, useExisting: NgpDatePickerPreviousMonth },
724
- { provide: NgpDisabledToken, useExisting: NgpDatePickerPreviousMonth },
725
- ],
726
674
  hostDirectives: [NgpButton],
727
675
  host: {
728
676
  '[attr.data-disabled]': 'disabled() ? "" : null',
@@ -731,7 +679,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.7", ngImpor
731
679
  '[attr.type]': 'isButton ? "button" : null',
732
680
  },
733
681
  }]
734
- }], propDecorators: { navigateToPreviouMonth: [{
682
+ }], ctorParameters: () => [], propDecorators: { navigateToPreviouMonth: [{
735
683
  type: HostListener,
736
684
  args: ['click']
737
685
  }] } });
@@ -990,5 +938,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.7", ngImpor
990
938
  * Generated bundle index. Do not edit.
991
939
  */
992
940
 
993
- export { NgpDatePicker, NgpDatePickerCell, NgpDatePickerCellRender, NgpDatePickerCellRenderToken, NgpDatePickerCellToken, NgpDatePickerDateButton, NgpDatePickerDateButtonToken, NgpDatePickerGrid, NgpDatePickerGridToken, NgpDatePickerLabel, NgpDatePickerLabelToken, NgpDatePickerNextMonth, NgpDatePickerNextMonthToken, NgpDatePickerPreviousMonth, NgpDatePickerPreviousMonthToken, NgpDatePickerRowRender, NgpDatePickerRowRenderToken, NgpDatePickerToken, injectDatePicker, injectDatePickerCell, injectDatePickerCellDate, injectDatePickerCellRender, injectDatePickerDateButton, injectDatePickerGrid, injectDatePickerLabel, injectDatePickerNextMonth, injectDatePickerPreviousMonth, injectDatePickerRowRender, injectDatePickerState, injectDatePickerWeek, provideDatePickerState };
941
+ export { NgpDatePicker, NgpDatePickerCell, NgpDatePickerCellRender, NgpDatePickerCellRenderToken, NgpDatePickerDateButton, NgpDatePickerDateButtonToken, NgpDatePickerGrid, NgpDatePickerLabel, NgpDatePickerLabelToken, NgpDatePickerNextMonth, NgpDatePickerPreviousMonth, NgpDatePickerRowRender, NgpDatePickerRowRenderToken, NgpDatePickerToken, injectDatePicker, injectDatePickerCellDate, injectDatePickerCellRender, injectDatePickerDateButton, injectDatePickerLabel, injectDatePickerRowRender, injectDatePickerState, injectDatePickerWeek, provideDatePickerState };
994
942
  //# sourceMappingURL=ng-primitives-date-picker.mjs.map