ng-primitives 0.89.0 → 0.91.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 (389) hide show
  1. package/a11y/index.d.ts +98 -3
  2. package/accordion/index.d.ts +361 -7
  3. package/ai/index.d.ts +238 -16
  4. package/autofill/index.d.ts +62 -1
  5. package/avatar/index.d.ts +155 -5
  6. package/breadcrumbs/index.d.ts +200 -7
  7. package/button/index.d.ts +39 -3
  8. package/checkbox/index.d.ts +137 -2
  9. package/combobox/index.d.ts +414 -8
  10. package/common/index.d.ts +31 -4
  11. package/date-picker/index.d.ts +714 -18
  12. package/date-time/index.d.ts +289 -3
  13. package/date-time-luxon/index.d.ts +31 -1
  14. package/dialog/index.d.ts +253 -9
  15. package/fesm2022/ng-primitives-a11y.mjs +42 -58
  16. package/fesm2022/ng-primitives-a11y.mjs.map +1 -1
  17. package/fesm2022/ng-primitives-accordion.mjs +249 -225
  18. package/fesm2022/ng-primitives-accordion.mjs.map +1 -1
  19. package/fesm2022/ng-primitives-ai.mjs +61 -58
  20. package/fesm2022/ng-primitives-ai.mjs.map +1 -1
  21. package/fesm2022/ng-primitives-autofill.mjs +55 -38
  22. package/fesm2022/ng-primitives-autofill.mjs.map +1 -1
  23. package/fesm2022/ng-primitives-avatar.mjs +105 -145
  24. package/fesm2022/ng-primitives-avatar.mjs.map +1 -1
  25. package/fesm2022/ng-primitives-breadcrumbs.mjs +106 -49
  26. package/fesm2022/ng-primitives-breadcrumbs.mjs.map +1 -1
  27. package/fesm2022/ng-primitives-button.mjs +20 -42
  28. package/fesm2022/ng-primitives-button.mjs.map +1 -1
  29. package/fesm2022/ng-primitives-checkbox.mjs +110 -84
  30. package/fesm2022/ng-primitives-checkbox.mjs.map +1 -1
  31. package/fesm2022/ng-primitives-combobox.mjs +82 -78
  32. package/fesm2022/ng-primitives-combobox.mjs.map +1 -1
  33. package/fesm2022/ng-primitives-common.mjs +5 -5
  34. package/fesm2022/ng-primitives-common.mjs.map +1 -1
  35. package/fesm2022/ng-primitives-date-picker.mjs +119 -112
  36. package/fesm2022/ng-primitives-date-picker.mjs.map +1 -1
  37. package/fesm2022/ng-primitives-dialog.mjs +48 -47
  38. package/fesm2022/ng-primitives-dialog.mjs.map +1 -1
  39. package/fesm2022/ng-primitives-file-upload.mjs +56 -48
  40. package/fesm2022/ng-primitives-file-upload.mjs.map +1 -1
  41. package/fesm2022/ng-primitives-focus-trap.mjs +9 -8
  42. package/fesm2022/ng-primitives-focus-trap.mjs.map +1 -1
  43. package/fesm2022/ng-primitives-form-field.mjs +97 -64
  44. package/fesm2022/ng-primitives-form-field.mjs.map +1 -1
  45. package/fesm2022/ng-primitives-input-otp.mjs +44 -43
  46. package/fesm2022/ng-primitives-input-otp.mjs.map +1 -1
  47. package/fesm2022/ng-primitives-input.mjs +38 -54
  48. package/fesm2022/ng-primitives-input.mjs.map +1 -1
  49. package/fesm2022/ng-primitives-interactions.mjs +59 -54
  50. package/fesm2022/ng-primitives-interactions.mjs.map +1 -1
  51. package/fesm2022/ng-primitives-internal.mjs +14 -14
  52. package/fesm2022/ng-primitives-internal.mjs.map +1 -1
  53. package/fesm2022/ng-primitives-listbox.mjs +52 -50
  54. package/fesm2022/ng-primitives-listbox.mjs.map +1 -1
  55. package/fesm2022/ng-primitives-menu.mjs +86 -72
  56. package/fesm2022/ng-primitives-menu.mjs.map +1 -1
  57. package/fesm2022/ng-primitives-meter.mjs +38 -35
  58. package/fesm2022/ng-primitives-meter.mjs.map +1 -1
  59. package/fesm2022/ng-primitives-pagination.mjs +83 -74
  60. package/fesm2022/ng-primitives-pagination.mjs.map +1 -1
  61. package/fesm2022/ng-primitives-popover.mjs +67 -60
  62. package/fesm2022/ng-primitives-popover.mjs.map +1 -1
  63. package/fesm2022/ng-primitives-portal.mjs +11 -12
  64. package/fesm2022/ng-primitives-portal.mjs.map +1 -1
  65. package/fesm2022/ng-primitives-progress.mjs +43 -40
  66. package/fesm2022/ng-primitives-progress.mjs.map +1 -1
  67. package/fesm2022/ng-primitives-radio.mjs +35 -33
  68. package/fesm2022/ng-primitives-radio.mjs.map +1 -1
  69. package/fesm2022/ng-primitives-resize.mjs +4 -4
  70. package/fesm2022/ng-primitives-resize.mjs.map +1 -1
  71. package/fesm2022/ng-primitives-roving-focus.mjs +264 -237
  72. package/fesm2022/ng-primitives-roving-focus.mjs.map +1 -1
  73. package/fesm2022/ng-primitives-search.mjs +9 -9
  74. package/fesm2022/ng-primitives-search.mjs.map +1 -1
  75. package/fesm2022/ng-primitives-select.mjs +73 -69
  76. package/fesm2022/ng-primitives-select.mjs.map +1 -1
  77. package/fesm2022/ng-primitives-separator.mjs +7 -7
  78. package/fesm2022/ng-primitives-separator.mjs.map +1 -1
  79. package/fesm2022/ng-primitives-slider.mjs +287 -253
  80. package/fesm2022/ng-primitives-slider.mjs.map +1 -1
  81. package/fesm2022/ng-primitives-state.mjs +173 -3
  82. package/fesm2022/ng-primitives-state.mjs.map +1 -1
  83. package/fesm2022/ng-primitives-switch.mjs +105 -101
  84. package/fesm2022/ng-primitives-switch.mjs.map +1 -1
  85. package/fesm2022/ng-primitives-tabs.mjs +48 -43
  86. package/fesm2022/ng-primitives-tabs.mjs.map +1 -1
  87. package/fesm2022/ng-primitives-textarea.mjs +33 -41
  88. package/fesm2022/ng-primitives-textarea.mjs.map +1 -1
  89. package/fesm2022/ng-primitives-toast.mjs +19 -19
  90. package/fesm2022/ng-primitives-toast.mjs.map +1 -1
  91. package/fesm2022/ng-primitives-toggle-group.mjs +160 -159
  92. package/fesm2022/ng-primitives-toggle-group.mjs.map +1 -1
  93. package/fesm2022/ng-primitives-toggle.mjs +81 -68
  94. package/fesm2022/ng-primitives-toggle.mjs.map +1 -1
  95. package/fesm2022/ng-primitives-toolbar.mjs +31 -40
  96. package/fesm2022/ng-primitives-toolbar.mjs.map +1 -1
  97. package/fesm2022/ng-primitives-tooltip.mjs +68 -60
  98. package/fesm2022/ng-primitives-tooltip.mjs.map +1 -1
  99. package/fesm2022/ng-primitives-utils.mjs +50 -37
  100. package/fesm2022/ng-primitives-utils.mjs.map +1 -1
  101. package/file-upload/index.d.ts +148 -4
  102. package/focus-trap/index.d.ts +98 -2
  103. package/form-field/index.d.ts +266 -7
  104. package/index.d.ts +2 -2
  105. package/input/index.d.ts +84 -2
  106. package/input-otp/index.d.ts +247 -4
  107. package/interactions/index.d.ts +295 -16
  108. package/internal/index.d.ts +201 -10
  109. package/listbox/index.d.ts +209 -6
  110. package/menu/index.d.ts +297 -8
  111. package/meter/index.d.ts +67 -6
  112. package/package.json +28 -28
  113. package/pagination/index.d.ts +211 -7
  114. package/popover/index.d.ts +224 -5
  115. package/portal/index.d.ts +389 -6
  116. package/progress/index.d.ts +124 -6
  117. package/radio/index.d.ts +140 -5
  118. package/resize/index.d.ts +29 -1
  119. package/roving-focus/index.d.ts +154 -4
  120. package/schematics/ng-add/schema.d.ts +0 -1
  121. package/schematics/ng-generate/__snapshots__/index.spec.ts.snap +1 -1
  122. package/schematics/ng-generate/templates/checkbox/checkbox.__fileSuffix@dasherize__.ts.template +2 -2
  123. package/schematics/ng-generate/templates/slider/slider.__fileSuffix@dasherize__.ts.template +6 -3
  124. package/schematics/ng-generate/templates/switch/switch.__fileSuffix@dasherize__.ts.template +2 -2
  125. package/schematics/ng-generate/templates/toggle/toggle.__fileSuffix@dasherize__.ts.template +2 -2
  126. package/schematics/ng-generate/templates/toggle-group/toggle-group.__fileSuffix@dasherize__.ts.template +2 -2
  127. package/schematics/ng-generate/templates/toolbar/toolbar.__fileSuffix@dasherize__.ts.template +1 -1
  128. package/search/index.d.ts +66 -3
  129. package/select/index.d.ts +341 -8
  130. package/separator/index.d.ts +30 -2
  131. package/slider/index.d.ts +471 -10
  132. package/state/index.d.ts +68 -11
  133. package/switch/index.d.ts +151 -3
  134. package/tabs/index.d.ts +222 -7
  135. package/textarea/index.d.ts +87 -2
  136. package/toast/index.d.ts +219 -4
  137. package/toggle/index.d.ts +98 -2
  138. package/toggle-group/index.d.ts +168 -5
  139. package/toolbar/index.d.ts +43 -2
  140. package/tooltip/index.d.ts +214 -5
  141. package/utils/index.d.ts +170 -9
  142. package/a11y/active-descendant/active-descendant.d.ts +0 -42
  143. package/a11y/visually-hidden/visually-hidden-state.d.ts +0 -17
  144. package/a11y/visually-hidden/visually-hidden.d.ts +0 -50
  145. package/accordion/accordion/accordion-state.d.ts +0 -17
  146. package/accordion/accordion/accordion.d.ts +0 -50
  147. package/accordion/accordion-content/accordion-content.d.ts +0 -40
  148. package/accordion/accordion-item/accordion-item-state.d.ts +0 -17
  149. package/accordion/accordion-item/accordion-item.d.ts +0 -50
  150. package/accordion/accordion-trigger/accordion-trigger.d.ts +0 -31
  151. package/accordion/config/accordion-config.d.ts +0 -32
  152. package/ai/prompt-composer/prompt-composer-state.d.ts +0 -17
  153. package/ai/prompt-composer/prompt-composer.d.ts +0 -23
  154. package/ai/prompt-composer-dictation/prompt-composer-dictation-state.d.ts +0 -17
  155. package/ai/prompt-composer-dictation/prompt-composer-dictation.d.ts +0 -29
  156. package/ai/prompt-composer-input/prompt-composer-input-state.d.ts +0 -17
  157. package/ai/prompt-composer-input/prompt-composer-input.d.ts +0 -16
  158. package/ai/prompt-composer-submit/prompt-composer-submit-state.d.ts +0 -17
  159. package/ai/prompt-composer-submit/prompt-composer-submit.d.ts +0 -15
  160. package/ai/thread/thread-state.d.ts +0 -17
  161. package/ai/thread/thread.d.ts +0 -23
  162. package/ai/thread-message/thread-message-state.d.ts +0 -17
  163. package/ai/thread-message/thread-message.d.ts +0 -11
  164. package/ai/thread-suggestion/thread-suggestion-state.d.ts +0 -17
  165. package/ai/thread-suggestion/thread-suggestion.d.ts +0 -14
  166. package/ai/thread-viewport/thread-viewport-state.d.ts +0 -17
  167. package/ai/thread-viewport/thread-viewport.d.ts +0 -34
  168. package/autofill/autofill/autofill.d.ts +0 -19
  169. package/avatar/avatar/avatar-state.d.ts +0 -17
  170. package/avatar/avatar/avatar.d.ts +0 -29
  171. package/avatar/avatar-fallback/avatar-fallback.d.ts +0 -37
  172. package/avatar/avatar-image/avatar-image.d.ts +0 -27
  173. package/avatar/config/avatar-config.d.ts +0 -21
  174. package/breadcrumbs/breadcrumb-ellipsis/breadcrumb-ellipsis.d.ts +0 -8
  175. package/breadcrumbs/breadcrumb-item/breadcrumb-item.d.ts +0 -8
  176. package/breadcrumbs/breadcrumb-link/breadcrumb-link.d.ts +0 -9
  177. package/breadcrumbs/breadcrumb-list/breadcrumb-list.d.ts +0 -8
  178. package/breadcrumbs/breadcrumb-page/breadcrumb-page.d.ts +0 -8
  179. package/breadcrumbs/breadcrumb-separator/breadcrumb-separator.d.ts +0 -8
  180. package/breadcrumbs/breadcrumbs/breadcrumbs.d.ts +0 -8
  181. package/button/button/button-state.d.ts +0 -17
  182. package/button/button/button.d.ts +0 -15
  183. package/button/button/setup-button.d.ts +0 -15
  184. package/checkbox/checkbox/checkbox-state.d.ts +0 -17
  185. package/checkbox/checkbox/checkbox.d.ts +0 -45
  186. package/combobox/combobox/combobox-state.d.ts +0 -17
  187. package/combobox/combobox/combobox.d.ts +0 -222
  188. package/combobox/combobox-button/combobox-button.d.ts +0 -18
  189. package/combobox/combobox-dropdown/combobox-dropdown.d.ts +0 -21
  190. package/combobox/combobox-input/combobox-input.d.ts +0 -36
  191. package/combobox/combobox-option/combobox-option.d.ts +0 -51
  192. package/combobox/combobox-portal/combobox-portal.d.ts +0 -37
  193. package/combobox/config/combobox-config.d.ts +0 -28
  194. package/combobox/utils.d.ts +0 -9
  195. package/common/header/header-token.d.ts +0 -10
  196. package/common/header/header.d.ts +0 -13
  197. package/common/types/orientation.d.ts +0 -1
  198. package/common/types/selection.d.ts +0 -1
  199. package/date-picker/config/date-picker-config.d.ts +0 -22
  200. package/date-picker/date-picker/date-picker-first-day-of-week.d.ts +0 -29
  201. package/date-picker/date-picker/date-picker-state.d.ts +0 -9
  202. package/date-picker/date-picker/date-picker.d.ts +0 -129
  203. package/date-picker/date-picker-cell/date-picker-cell.d.ts +0 -20
  204. package/date-picker/date-picker-cell-render/date-picker-cell-render-token.d.ts +0 -12
  205. package/date-picker/date-picker-cell-render/date-picker-cell-render.d.ts +0 -39
  206. package/date-picker/date-picker-date-button/date-picker-date-button-token.d.ts +0 -7
  207. package/date-picker/date-picker-date-button/date-picker-date-button.d.ts +0 -114
  208. package/date-picker/date-picker-grid/date-picker-grid.d.ts +0 -16
  209. package/date-picker/date-picker-label/date-picker-label-token.d.ts +0 -7
  210. package/date-picker/date-picker-label/date-picker-label.d.ts +0 -20
  211. package/date-picker/date-picker-next-month/date-picker-next-month.d.ts +0 -34
  212. package/date-picker/date-picker-previous-month/date-picker-previous-month.d.ts +0 -34
  213. package/date-picker/date-picker-row-render/date-picker-row-render-token.d.ts +0 -12
  214. package/date-picker/date-picker-row-render/date-picker-row-render.d.ts +0 -65
  215. package/date-picker/date-range-picker/date-range-picker-state.d.ts +0 -19
  216. package/date-picker/date-range-picker/date-range-picker.d.ts +0 -149
  217. package/date-time/date-adapter/date-adapter-token.d.ts +0 -11
  218. package/date-time/date-adapter/date-adapter.d.ts +0 -169
  219. package/date-time/native-date-adapter/native-date-adapter.d.ts +0 -106
  220. package/date-time-luxon/luxon-date-adapter/luxon-date-adapter.d.ts +0 -28
  221. package/dialog/config/dialog-config.d.ts +0 -41
  222. package/dialog/dialog/dialog-ref.d.ts +0 -45
  223. package/dialog/dialog/dialog-state.d.ts +0 -17
  224. package/dialog/dialog/dialog.d.ts +0 -37
  225. package/dialog/dialog/dialog.service.d.ts +0 -69
  226. package/dialog/dialog-description/dialog-description.d.ts +0 -12
  227. package/dialog/dialog-overlay/dialog-overlay.d.ts +0 -16
  228. package/dialog/dialog-title/dialog-title.d.ts +0 -12
  229. package/dialog/dialog-trigger/dialog-trigger.d.ts +0 -26
  230. package/file-upload/file-dropzone/file-drop-filter.d.ts +0 -2
  231. package/file-upload/file-dropzone/file-dropzone-state.d.ts +0 -17
  232. package/file-upload/file-dropzone/file-dropzone.d.ts +0 -55
  233. package/file-upload/file-upload/file-upload-state.d.ts +0 -17
  234. package/file-upload/file-upload/file-upload.d.ts +0 -72
  235. package/focus-trap/focus-trap/focus-trap-state.d.ts +0 -17
  236. package/focus-trap/focus-trap/focus-trap.d.ts +0 -85
  237. package/form-field/description/description.d.ts +0 -17
  238. package/form-field/error/error.d.ts +0 -32
  239. package/form-field/form-control/form-control-state.d.ts +0 -17
  240. package/form-field/form-control/form-control.d.ts +0 -44
  241. package/form-field/form-field/form-field-state.d.ts +0 -17
  242. package/form-field/form-field/form-field.d.ts +0 -119
  243. package/form-field/label/label.d.ts +0 -30
  244. package/input/input/input-state.d.ts +0 -17
  245. package/input/input/input.d.ts +0 -34
  246. package/input-otp/input-otp/input-otp-state.d.ts +0 -17
  247. package/input-otp/input-otp/input-otp.d.ts +0 -133
  248. package/input-otp/input-otp-input/input-otp-input.d.ts +0 -57
  249. package/input-otp/input-otp-slot/input-otp-slot.d.ts +0 -45
  250. package/interactions/config/interactions-config.d.ts +0 -30
  251. package/interactions/focus/focus-interaction.d.ts +0 -14
  252. package/interactions/focus/focus.d.ts +0 -19
  253. package/interactions/focus-visible/focus-visible-interaction.d.ts +0 -12
  254. package/interactions/focus-visible/focus-visible.d.ts +0 -19
  255. package/interactions/hover/hover-interaction.d.ts +0 -17
  256. package/interactions/hover/hover.d.ts +0 -31
  257. package/interactions/interactions/interactions.d.ts +0 -20
  258. package/interactions/move/move.d.ts +0 -114
  259. package/interactions/press/press-interaction.d.ts +0 -14
  260. package/interactions/press/press.d.ts +0 -26
  261. package/internal/exit-animation/exit-animation-manager.d.ts +0 -17
  262. package/internal/exit-animation/exit-animation.d.ts +0 -26
  263. package/internal/signals/explicit-effect.d.ts +0 -19
  264. package/internal/style-injector/style-injector.d.ts +0 -44
  265. package/internal/utilities/dom-removal.d.ts +0 -6
  266. package/internal/utilities/element-ref.d.ts +0 -6
  267. package/internal/utilities/mutation-observer.d.ts +0 -39
  268. package/internal/utilities/overflow.d.ts +0 -13
  269. package/internal/utilities/resize.d.ts +0 -31
  270. package/internal/utilities/scrolling.d.ts +0 -1
  271. package/listbox/listbox/listbox-state.d.ts +0 -17
  272. package/listbox/listbox/listbox.d.ts +0 -101
  273. package/listbox/listbox-header/listbox-header.d.ts +0 -9
  274. package/listbox/listbox-option/listbox-option.d.ts +0 -68
  275. package/listbox/listbox-section/listbox-section.d.ts +0 -9
  276. package/listbox/listbox-trigger/listbox-trigger.d.ts +0 -13
  277. package/menu/config/menu-config.d.ts +0 -44
  278. package/menu/menu/menu-token.d.ts +0 -11
  279. package/menu/menu/menu.d.ts +0 -22
  280. package/menu/menu-item/menu-item.d.ts +0 -30
  281. package/menu/menu-trigger/menu-trigger-state.d.ts +0 -17
  282. package/menu/menu-trigger/menu-trigger.d.ts +0 -98
  283. package/menu/submenu-trigger/submenu-trigger-state.d.ts +0 -17
  284. package/menu/submenu-trigger/submenu-trigger.d.ts +0 -88
  285. package/meter/meter/meter-state.d.ts +0 -17
  286. package/meter/meter/meter.d.ts +0 -27
  287. package/meter/meter-indicator/meter-indicator.d.ts +0 -7
  288. package/meter/meter-label/meter-label.d.ts +0 -10
  289. package/meter/meter-track/meter-track.d.ts +0 -5
  290. package/meter/meter-value/meter-value.d.ts +0 -5
  291. package/pagination/pagination/pagination-state.d.ts +0 -17
  292. package/pagination/pagination/pagination.d.ts +0 -45
  293. package/pagination/pagination-button/pagination-button.d.ts +0 -39
  294. package/pagination/pagination-first/pagination-first.d.ts +0 -28
  295. package/pagination/pagination-last/pagination-last.d.ts +0 -28
  296. package/pagination/pagination-next/pagination-next.d.ts +0 -31
  297. package/pagination/pagination-previous/pagination-previous.d.ts +0 -31
  298. package/popover/config/popover-config.d.ts +0 -64
  299. package/popover/popover/popover.d.ts +0 -18
  300. package/popover/popover-arrow/popover-arrow.d.ts +0 -6
  301. package/popover/popover-trigger/popover-trigger-state.d.ts +0 -19
  302. package/popover/popover-trigger/popover-trigger.d.ts +0 -128
  303. package/portal/offset.d.ts +0 -39
  304. package/portal/overlay-arrow.d.ts +0 -1
  305. package/portal/overlay-token.d.ts +0 -12
  306. package/portal/overlay.d.ts +0 -214
  307. package/portal/portal.d.ts +0 -94
  308. package/portal/scroll-strategy.d.ts +0 -23
  309. package/progress/progress/progress-state.d.ts +0 -17
  310. package/progress/progress/progress.d.ts +0 -61
  311. package/progress/progress-indicator/progress-indicator.d.ts +0 -17
  312. package/progress/progress-label/progress-label.d.ts +0 -14
  313. package/progress/progress-track/progress-track.d.ts +0 -9
  314. package/progress/progress-value/progress-value.d.ts +0 -9
  315. package/radio/radio-group/radio-group-state.d.ts +0 -18
  316. package/radio/radio-group/radio-group.d.ts +0 -54
  317. package/radio/radio-indicator/radio-indicator.d.ts +0 -21
  318. package/radio/radio-item/radio-item-state.d.ts +0 -18
  319. package/radio/radio-item/radio-item.d.ts +0 -45
  320. package/resize/resize/resize.d.ts +0 -26
  321. package/roving-focus/roving-focus-group/roving-focus-group-state.d.ts +0 -17
  322. package/roving-focus/roving-focus-group/roving-focus-group-token.d.ts +0 -21
  323. package/roving-focus/roving-focus-group/roving-focus-group.d.ts +0 -94
  324. package/roving-focus/roving-focus-item/roving-focus-item.d.ts +0 -53
  325. package/search/search/search-state.d.ts +0 -17
  326. package/search/search/search.d.ts +0 -36
  327. package/search/search-clear/search-clear.d.ts +0 -16
  328. package/select/config/select-config.d.ts +0 -28
  329. package/select/native-select/native-select-state.d.ts +0 -17
  330. package/select/native-select/native-select.d.ts +0 -22
  331. package/select/select/select-state.d.ts +0 -17
  332. package/select/select/select.d.ts +0 -172
  333. package/select/select-dropdown/select-dropdown.d.ts +0 -17
  334. package/select/select-option/select-option.d.ts +0 -51
  335. package/select/select-portal/select-portal.d.ts +0 -37
  336. package/separator/config/separator-config.d.ts +0 -22
  337. package/separator/separator/separator.d.ts +0 -11
  338. package/slider/range-slider/range-slider/range-slider-state.d.ts +0 -17
  339. package/slider/range-slider/range-slider/range-slider.d.ts +0 -115
  340. package/slider/range-slider/range-slider-range/range-slider-range.d.ts +0 -12
  341. package/slider/range-slider/range-slider-thumb/range-slider-thumb.d.ts +0 -44
  342. package/slider/range-slider/range-slider-track/range-slider-track.d.ts +0 -22
  343. package/slider/slider/slider-state.d.ts +0 -17
  344. package/slider/slider/slider.d.ts +0 -58
  345. package/slider/slider-range/slider-range.d.ts +0 -12
  346. package/slider/slider-thumb/slider-thumb.d.ts +0 -29
  347. package/slider/slider-track/slider-track.d.ts +0 -22
  348. package/switch/switch/switch-state.d.ts +0 -17
  349. package/switch/switch/switch.d.ts +0 -49
  350. package/switch/switch-thumb/switch-thumb.d.ts +0 -13
  351. package/tabs/config/tabs-config.d.ts +0 -32
  352. package/tabs/tab-button/tab-button.d.ts +0 -59
  353. package/tabs/tab-list/tab-list.d.ts +0 -12
  354. package/tabs/tab-panel/tab-panel-token.d.ts +0 -8
  355. package/tabs/tab-panel/tab-panel.d.ts +0 -38
  356. package/tabs/tabset/tabset-state.d.ts +0 -17
  357. package/tabs/tabset/tabset.d.ts +0 -71
  358. package/textarea/textarea/textarea-state.d.ts +0 -17
  359. package/textarea/textarea/textarea.d.ts +0 -19
  360. package/toast/config/toast-config.d.ts +0 -70
  361. package/toast/toast/toast-context.d.ts +0 -3
  362. package/toast/toast/toast-manager.d.ts +0 -49
  363. package/toast/toast/toast-options.d.ts +0 -34
  364. package/toast/toast/toast-timer.d.ts +0 -14
  365. package/toast/toast/toast.d.ts +0 -72
  366. package/toggle/toggle/toggle-state.d.ts +0 -17
  367. package/toggle/toggle/toggle.d.ts +0 -44
  368. package/toggle-group/config/toggle-group-config.d.ts +0 -32
  369. package/toggle-group/toggle-group/toggle-group-state.d.ts +0 -17
  370. package/toggle-group/toggle-group/toggle-group.d.ts +0 -64
  371. package/toggle-group/toggle-group-item/toggle-group-item-state.d.ts +0 -17
  372. package/toggle-group/toggle-group-item/toggle-group-item.d.ts +0 -34
  373. package/toolbar/toolbar/toolbar-state.d.ts +0 -17
  374. package/toolbar/toolbar/toolbar.d.ts +0 -20
  375. package/tooltip/config/tooltip-config.d.ts +0 -59
  376. package/tooltip/tooltip/tooltip.d.ts +0 -17
  377. package/tooltip/tooltip-arrow/tooltip-arrow.d.ts +0 -6
  378. package/tooltip/tooltip-text-content/tooltip-text-content.component.d.ts +0 -14
  379. package/tooltip/tooltip-trigger/tooltip-trigger-state.d.ts +0 -17
  380. package/tooltip/tooltip-trigger/tooltip-trigger.d.ts +0 -126
  381. package/utils/forms/providers.d.ts +0 -6
  382. package/utils/forms/status.d.ts +0 -16
  383. package/utils/forms/types.d.ts +0 -8
  384. package/utils/helpers/attributes.d.ts +0 -2
  385. package/utils/helpers/disposables.d.ts +0 -40
  386. package/utils/helpers/unique-id.d.ts +0 -6
  387. package/utils/helpers/validators.d.ts +0 -51
  388. package/utils/observables/take-until-destroyed.d.ts +0 -10
  389. package/utils/signals/index.d.ts +0 -22
@@ -1,190 +1,92 @@
1
- import { Directionality } from '@angular/cdk/bidi';
2
1
  import * as i0 from '@angular/core';
3
- import { InjectionToken, inject, input, booleanAttribute, signal, Directive, ElementRef, computed, HostListener } from '@angular/core';
4
- import { createStateToken, createStateProvider, createStateInjector, createState } from 'ng-primitives/state';
2
+ import { inject, signal, InjectionToken, input, booleanAttribute, Directive, computed } from '@angular/core';
3
+ import { Directionality } from '@angular/cdk/bidi';
4
+ import { createPrimitive, injectInheritedState, controlled, attrBinding, listener, onDestroy } from 'ng-primitives/state';
5
5
  import { FocusMonitor } from '@angular/cdk/a11y';
6
+ import { injectElementRef } from 'ng-primitives/internal';
7
+ import { uniqueId } from 'ng-primitives/utils';
6
8
 
7
- /**
8
- * The state token for the RovingFocusGroup primitive.
9
- */
10
- const NgpRovingFocusGroupStateToken = createStateToken('RovingFocusGroup');
11
- /**
12
- * Provides the RovingFocusGroup state.
13
- */
14
- const provideRovingFocusGroupState = createStateProvider(NgpRovingFocusGroupStateToken);
15
- /**
16
- * Injects the RovingFocusGroup state.
17
- */
18
- const injectRovingFocusGroupState = createStateInjector(NgpRovingFocusGroupStateToken);
19
- /**
20
- * The RovingFocusGroup state registration function.
21
- */
22
- const rovingFocusGroupState = createState(NgpRovingFocusGroupStateToken);
23
-
24
- const NgpRovingFocusGroupToken = new InjectionToken('NgpRovingFocusGroupToken');
25
- /**
26
- * Inject the RovingFocusGroup directive instance
27
- * @returns The RovingFocusGroup directive instance
28
- */
29
- function injectRovingFocusGroup() {
30
- return inject(NgpRovingFocusGroupToken);
31
- }
32
- /**
33
- * Provide the RovingFocusGroup directive instance
34
- * @param type The RovingFocusGroup directive type
35
- * @returns The RovingFocusGroup token
36
- */
37
- function provideRovingFocusGroup(type, { inherit = true } = {}) {
38
- return {
39
- provide: NgpRovingFocusGroupToken,
40
- // Roving focus groups may be nested, in this case, the parent group should be used
41
- useFactory: () => {
42
- if (!inherit) {
43
- return inject(type, { self: true });
44
- }
45
- // If the parent group is not found, return the current group
46
- // This is useful for nested groups
47
- return (inject(NgpRovingFocusGroupToken, { skipSelf: true, optional: true }) ??
48
- inject(type, { self: true }));
49
- },
50
- };
51
- }
52
-
53
- /**
54
- * Apply the `ngpRovingFocusGroup` directive to an element to manage focus for a group of child elements.
55
- */
56
- class NgpRovingFocusGroup {
57
- constructor() {
58
- /**
59
- * Access the directionality service.
60
- */
61
- this.directionality = inject(Directionality);
62
- /**
63
- * Determine the orientation of the roving focus group.
64
- * @default 'vertical'
65
- */
66
- this.orientation = input('vertical', {
67
- alias: 'ngpRovingFocusGroupOrientation',
68
- });
69
- /**
70
- * Determine if focus should wrap when the end or beginning is reached.
71
- */
72
- this.wrap = input(true, {
73
- alias: 'ngpRovingFocusGroupWrap',
74
- transform: booleanAttribute,
75
- });
76
- /**
77
- * Determine if the home and end keys should navigate to the first and last items.
78
- */
79
- this.homeEnd = input(true, {
80
- alias: 'ngpRovingFocusGroupHomeEnd',
81
- transform: booleanAttribute,
82
- });
83
- /**
84
- * Determine if the roving focus group is disabled.
85
- */
86
- this.disabled = input(false, {
87
- alias: 'ngpRovingFocusGroupDisabled',
88
- transform: booleanAttribute,
89
- });
90
- /**
91
- * Store the items in the roving focus group.
92
- */
93
- this.items = signal([]);
94
- /**
95
- * Store the active item in the roving focus group.
96
- * @internal
97
- */
98
- this.activeItem = signal(null);
99
- /**
100
- * The state of the roving focus group.
101
- */
102
- this.state = rovingFocusGroupState(this);
9
+ const [NgpRovingFocusGroupStateToken, ngpRovingFocusGroup, injectRovingFocusGroupState, provideRovingFocusGroupState,] = createPrimitive('NgpRovingFocusGroup', ({ orientation: _orientation = signal('vertical'), wrap = signal(false), homeEnd = signal(true), disabled = signal(false), inherit = true, }) => {
10
+ const parentGroup = inherit
11
+ ? injectInheritedState(() => NgpRovingFocusGroupStateToken)?.()
12
+ : null;
13
+ if (parentGroup) {
14
+ return parentGroup;
103
15
  }
16
+ const directionality = inject(Directionality);
17
+ const items = signal([], ...(ngDevMode ? [{ debugName: "items" }] : []));
18
+ const orientation = controlled(_orientation);
104
19
  /**
105
20
  * Get the items in the roving focus group sorted by order.
106
21
  */
107
- get sortedItems() {
108
- return this.items().sort((a, b) => {
22
+ function getSortedItems() {
23
+ return items().sort((a, b) => {
109
24
  // sort the items by their position in the document
110
- return a.elementRef.nativeElement.compareDocumentPosition(b.elementRef.nativeElement) &
25
+ return a.element.nativeElement.compareDocumentPosition(b.element.nativeElement) &
111
26
  Node.DOCUMENT_POSITION_FOLLOWING
112
27
  ? -1
113
28
  : 1;
114
29
  });
115
30
  }
116
31
  /**
117
- * Register an item with the roving focus group.
118
- * @param item The item to register
119
- * @internal
120
- */
121
- register(item) {
122
- this.items.update(items => [...items, item]);
123
- // if there is no active item, make the first item the tabbable item
124
- if (!this.activeItem()) {
125
- this.activeItem.set(item);
126
- }
127
- }
128
- /**
129
- * Unregister an item with the roving focus group.
130
- * @param item The item to unregister
131
- * @internal
32
+ * Store the active item in the roving focus group.
132
33
  */
133
- unregister(item) {
134
- this.items.update(items => items.filter(i => i !== item));
135
- // check if the unregistered item is the active item
136
- if (this.activeItem() === item) {
137
- // if the active item is unregistered, activate the first item
138
- this.activeItem.set(this.items()[0] ?? null);
139
- }
140
- }
34
+ const activeItem = signal(null, ...(ngDevMode ? [{ debugName: "activeItem" }] : []));
141
35
  /**
142
36
  * Activate an item in the roving focus group.
143
37
  * @param item The item to activate
144
38
  * @param origin The origin of the focus change
145
39
  */
146
- setActiveItem(item, origin = 'program') {
147
- this.activeItem.set(item);
148
- item?.focus(origin);
40
+ function setActiveItem(id, origin = 'program') {
41
+ activeItem.set(id);
42
+ const item = items().find(i => i.id() === id) ?? null;
43
+ if (item) {
44
+ item.focus(origin);
45
+ }
149
46
  }
150
47
  /**
151
48
  * Activate the first item in the roving focus group.
152
49
  * @param origin The origin of the focus change
153
50
  */
154
- activateFirstItem(origin) {
51
+ function activateFirstItem(origin) {
155
52
  // find the first item that is not disabled
156
- const item = this.sortedItems.find(i => !i.disabled()) ?? null;
53
+ const item = getSortedItems().find(i => !i.disabled()) ?? null;
157
54
  // set the first item as the active item
158
- this.setActiveItem(item, origin);
55
+ if (item) {
56
+ setActiveItem(item.id(), origin);
57
+ }
159
58
  }
160
59
  /**
161
60
  * Activate the last item in the roving focus group.
162
61
  * @param origin The origin of the focus change
163
62
  */
164
- activateLastItem(origin) {
63
+ function activateLastItem(origin) {
165
64
  // find the last item that is not disabled
166
- const item = [...this.sortedItems].reverse().find(i => !i.disabled()) ?? null;
65
+ const item = [...getSortedItems()].reverse().find(i => !i.disabled()) ?? null;
167
66
  // set the last item as the active item
168
- this.setActiveItem(item, origin);
67
+ if (item) {
68
+ setActiveItem(item.id(), origin);
69
+ }
169
70
  }
170
71
  /**
171
72
  * Activate the next item in the roving focus group.
172
73
  * @param origin The origin of the focus change
173
74
  */
174
- activateNextItem(origin) {
175
- const activeItem = this.activeItem();
75
+ function activateNextItem(origin) {
76
+ const currentActiveItem = activeItem();
176
77
  // if there is no active item, activate the first item
177
- if (!activeItem) {
178
- this.activateFirstItem(origin);
78
+ if (!currentActiveItem) {
79
+ activateFirstItem(origin);
179
80
  return;
180
81
  }
181
82
  // find the index of the active item
182
- const index = this.sortedItems.indexOf(activeItem);
83
+ const sortedItems = getSortedItems();
84
+ const index = sortedItems.findIndex(i => i.id() === currentActiveItem);
183
85
  // find the next item that is not disabled
184
- const item = this.sortedItems.slice(index + 1).find(i => !i.disabled()) ?? null;
86
+ const item = sortedItems.slice(index + 1).find(i => !i.disabled()) ?? null;
185
87
  // if we are at the end of the list, wrap to the beginning
186
- if (!item && this.state.wrap()) {
187
- this.activateFirstItem(origin);
88
+ if (!item && wrap()) {
89
+ activateFirstItem(origin);
188
90
  return;
189
91
  }
190
92
  // if there is no next item, do nothing
@@ -192,29 +94,30 @@ class NgpRovingFocusGroup {
192
94
  return;
193
95
  }
194
96
  // set the next item as the active item
195
- this.setActiveItem(item, origin);
97
+ setActiveItem(item.id(), origin);
196
98
  }
197
99
  /**
198
100
  * Activate the previous item in the roving focus group.
199
101
  * @param origin The origin of the focus change
200
102
  */
201
- activatePreviousItem(origin) {
202
- const activeItem = this.activeItem();
103
+ function activatePreviousItem(origin) {
104
+ const currentActiveItem = activeItem();
203
105
  // if there is no active item, activate the last item
204
- if (!activeItem) {
205
- this.activateLastItem(origin);
106
+ if (!currentActiveItem) {
107
+ activateLastItem(origin);
206
108
  return;
207
109
  }
208
110
  // find the index of the active item
209
- const index = this.sortedItems.indexOf(activeItem);
111
+ const sortedItems = getSortedItems();
112
+ const index = sortedItems.findIndex(i => i.id() === currentActiveItem);
210
113
  // find the previous item that is not disabled
211
- const item = this.sortedItems
114
+ const item = sortedItems
212
115
  .slice(0, index)
213
116
  .reverse()
214
117
  .find(i => !i.disabled()) ?? null;
215
118
  // if we are at the beginning of the list, wrap to the end
216
- if (!item && this.state.wrap()) {
217
- this.activateLastItem(origin);
119
+ if (!item && wrap()) {
120
+ activateLastItem(origin);
218
121
  return;
219
122
  }
220
123
  // if there is no previous item, do nothing
@@ -222,168 +125,292 @@ class NgpRovingFocusGroup {
222
125
  return;
223
126
  }
224
127
  // set the previous item as the active item
225
- this.setActiveItem(item, origin);
128
+ setActiveItem(item.id(), origin);
226
129
  }
227
130
  /**
228
131
  * Handle keyboard navigation for the roving focus group.
229
132
  * @param event The keyboard event
230
- * @internal
231
133
  */
232
- onKeydown(event) {
233
- if (this.state.disabled()) {
134
+ function onKeydown(event) {
135
+ if (disabled()) {
234
136
  return;
235
137
  }
236
138
  switch (event.key) {
237
139
  case 'ArrowUp':
238
- if (this.state.orientation() === 'vertical') {
140
+ if (orientation() === 'vertical') {
239
141
  event.preventDefault();
240
- this.activatePreviousItem('keyboard');
142
+ activatePreviousItem('keyboard');
241
143
  }
242
144
  break;
243
145
  case 'ArrowDown':
244
- if (this.state.orientation() === 'vertical') {
146
+ if (orientation() === 'vertical') {
245
147
  event.preventDefault();
246
- this.activateNextItem('keyboard');
148
+ activateNextItem('keyboard');
247
149
  }
248
150
  break;
249
151
  case 'ArrowLeft':
250
- if (this.state.orientation() === 'horizontal') {
152
+ if (orientation() === 'horizontal') {
251
153
  event.preventDefault();
252
- if (this.directionality.value === 'ltr') {
253
- this.activatePreviousItem('keyboard');
154
+ if (directionality.value === 'ltr') {
155
+ activatePreviousItem('keyboard');
254
156
  }
255
157
  else {
256
- this.activateNextItem('keyboard');
158
+ activateNextItem('keyboard');
257
159
  }
258
160
  }
259
161
  break;
260
162
  case 'ArrowRight':
261
- if (this.state.orientation() === 'horizontal') {
163
+ if (orientation() === 'horizontal') {
262
164
  event.preventDefault();
263
- if (this.directionality.value === 'ltr') {
264
- this.activateNextItem('keyboard');
165
+ if (directionality.value === 'ltr') {
166
+ activateNextItem('keyboard');
265
167
  }
266
168
  else {
267
- this.activatePreviousItem('keyboard');
169
+ activatePreviousItem('keyboard');
268
170
  }
269
171
  }
270
172
  break;
271
173
  case 'Home':
272
- if (this.state.homeEnd()) {
174
+ if (homeEnd()) {
273
175
  event.preventDefault();
274
- this.activateFirstItem('keyboard');
176
+ activateFirstItem('keyboard');
275
177
  }
276
178
  break;
277
179
  case 'End':
278
- if (this.state.homeEnd()) {
180
+ if (homeEnd()) {
279
181
  event.preventDefault();
280
- this.activateLastItem('keyboard');
182
+ activateLastItem('keyboard');
281
183
  }
282
184
  break;
283
185
  }
284
186
  }
285
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.11", ngImport: i0, type: NgpRovingFocusGroup, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
286
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.11", 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 } }, providers: [provideRovingFocusGroup(NgpRovingFocusGroup), provideRovingFocusGroupState()], exportAs: ["ngpRovingFocusGroup"], ngImport: i0 }); }
187
+ function register(item) {
188
+ items.update(items => [...items, item]);
189
+ // if there is no active item, make the first item the tabbable item
190
+ if (!activeItem()) {
191
+ activeItem.set(item.id());
192
+ }
193
+ }
194
+ /**
195
+ * Unregister an item with the roving focus group.
196
+ * @param item The item to unregister
197
+ * @internal
198
+ */
199
+ function unregister(item) {
200
+ items.update(items => items.filter(i => i !== item));
201
+ // check if the unregistered item is the active item
202
+ if (activeItem() === item.id()) {
203
+ // if the active item is unregistered, activate the first item
204
+ activeItem.set(items()[0]?.id() ?? null);
205
+ }
206
+ }
207
+ /**
208
+ * Set the orientation of the roving focus group.
209
+ * @param value The orientation value
210
+ */
211
+ function setOrientation(value) {
212
+ orientation.set(value);
213
+ }
214
+ return {
215
+ orientation: orientation.asReadonly(),
216
+ setOrientation,
217
+ wrap,
218
+ homeEnd,
219
+ disabled,
220
+ activeItem,
221
+ setActiveItem,
222
+ onKeydown,
223
+ register,
224
+ unregister,
225
+ };
226
+ });
227
+
228
+ const NgpRovingFocusGroupToken = new InjectionToken('NgpRovingFocusGroupToken');
229
+ /**
230
+ * Inject the RovingFocusGroup directive instance
231
+ * @returns The RovingFocusGroup directive instance
232
+ */
233
+ function injectRovingFocusGroup() {
234
+ return inject(NgpRovingFocusGroupToken);
235
+ }
236
+ /**
237
+ * Provide the RovingFocusGroup directive instance
238
+ * @param type The RovingFocusGroup directive type
239
+ * @returns The RovingFocusGroup token
240
+ */
241
+ function provideRovingFocusGroup(type, { inherit = true } = {}) {
242
+ return {
243
+ provide: NgpRovingFocusGroupToken,
244
+ // Roving focus groups may be nested, in this case, the parent group should be used
245
+ useFactory: () => {
246
+ if (!inherit) {
247
+ return inject(type, { self: true });
248
+ }
249
+ // If the parent group is not found, return the current group
250
+ // This is useful for nested groups
251
+ return (inject(NgpRovingFocusGroupToken, { skipSelf: true, optional: true }) ??
252
+ inject(type, { self: true }));
253
+ },
254
+ };
287
255
  }
288
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.11", ngImport: i0, type: NgpRovingFocusGroup, decorators: [{
289
- type: Directive,
290
- args: [{
291
- selector: '[ngpRovingFocusGroup]',
292
- exportAs: 'ngpRovingFocusGroup',
293
- providers: [provideRovingFocusGroup(NgpRovingFocusGroup), provideRovingFocusGroupState()],
294
- }]
295
- }] });
296
256
 
297
257
  /**
298
- * Apply the `ngpRovingFocusItem` directive to an element within a roving focus group to automatically manage focus.
258
+ * Apply the `ngpRovingFocusGroup` directive to an element to manage focus for a group of child elements.
299
259
  */
300
- class NgpRovingFocusItem {
260
+ class NgpRovingFocusGroup {
301
261
  constructor() {
302
262
  /**
303
- * Access the group the roving focus item belongs to.
263
+ * Determine the orientation of the roving focus group.
264
+ * @default 'vertical'
304
265
  */
305
- this.group = injectRovingFocusGroup();
266
+ this.orientation = input('vertical', ...(ngDevMode ? [{ debugName: "orientation", alias: 'ngpRovingFocusGroupOrientation' }] : [{
267
+ alias: 'ngpRovingFocusGroupOrientation',
268
+ }]));
306
269
  /**
307
- * Access the focus monitor service.
270
+ * Determine if focus should wrap when the end or beginning is reached.
308
271
  */
309
- this.focusMonitor = inject(FocusMonitor);
272
+ this.wrap = input(true, ...(ngDevMode ? [{ debugName: "wrap", alias: 'ngpRovingFocusGroupWrap',
273
+ transform: booleanAttribute }] : [{
274
+ alias: 'ngpRovingFocusGroupWrap',
275
+ transform: booleanAttribute,
276
+ }]));
310
277
  /**
311
- * Access the element the roving focus item is attached to.
278
+ * Determine if the home and end keys should navigate to the first and last items.
312
279
  */
313
- this.elementRef = inject(ElementRef);
280
+ this.homeEnd = input(true, ...(ngDevMode ? [{ debugName: "homeEnd", alias: 'ngpRovingFocusGroupHomeEnd',
281
+ transform: booleanAttribute }] : [{
282
+ alias: 'ngpRovingFocusGroupHomeEnd',
283
+ transform: booleanAttribute,
284
+ }]));
314
285
  /**
315
- * Define if the item is disabled.
286
+ * Determine if the roving focus group is disabled.
316
287
  */
317
- this.disabled = input(false, {
318
- alias: 'ngpRovingFocusItemDisabled',
319
- transform: booleanAttribute,
320
- });
288
+ this.disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled", alias: 'ngpRovingFocusGroupDisabled',
289
+ transform: booleanAttribute }] : [{
290
+ alias: 'ngpRovingFocusGroupDisabled',
291
+ transform: booleanAttribute,
292
+ }]));
321
293
  /**
322
- * Derive the tabindex of the roving focus item.
294
+ * Store the active item in the roving focus group.
295
+ * @internal
323
296
  */
324
- this.tabindex = computed(() => !this.group.disabled() && this.group.activeItem() === this ? 0 : -1);
325
- }
326
- /**
327
- * Initialize the roving focus item.
328
- */
329
- ngOnInit() {
330
- this.group.register(this);
297
+ this.activeItem = signal(null, ...(ngDevMode ? [{ debugName: "activeItem" }] : []));
298
+ /**
299
+ * The state of the roving focus group.
300
+ */
301
+ this.state = ngpRovingFocusGroup({
302
+ orientation: this.orientation,
303
+ wrap: this.wrap,
304
+ homeEnd: this.homeEnd,
305
+ disabled: this.disabled,
306
+ });
331
307
  }
332
308
  /**
333
- * Clean up the roving focus item.
309
+ * Activate an item in the roving focus group.
310
+ * @param item The item to activate
311
+ * @param origin The origin of the focus change
334
312
  */
335
- ngOnDestroy() {
336
- this.group.unregister(this);
313
+ setActiveItem(item, origin = 'program') {
314
+ if (item) {
315
+ this.state.setActiveItem(item.id(), origin);
316
+ }
337
317
  }
318
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: NgpRovingFocusGroup, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
319
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.3.9", 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 } }, providers: [
320
+ provideRovingFocusGroup(NgpRovingFocusGroup),
321
+ provideRovingFocusGroupState({ inherit: true }),
322
+ ], exportAs: ["ngpRovingFocusGroup"], ngImport: i0 }); }
323
+ }
324
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: NgpRovingFocusGroup, decorators: [{
325
+ type: Directive,
326
+ args: [{
327
+ selector: '[ngpRovingFocusGroup]',
328
+ exportAs: 'ngpRovingFocusGroup',
329
+ providers: [
330
+ provideRovingFocusGroup(NgpRovingFocusGroup),
331
+ provideRovingFocusGroupState({ inherit: true }),
332
+ ],
333
+ }]
334
+ }], propDecorators: { orientation: [{ type: i0.Input, args: [{ isSignal: true, alias: "ngpRovingFocusGroupOrientation", required: false }] }], wrap: [{ type: i0.Input, args: [{ isSignal: true, alias: "ngpRovingFocusGroupWrap", required: false }] }], homeEnd: [{ type: i0.Input, args: [{ isSignal: true, alias: "ngpRovingFocusGroupHomeEnd", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "ngpRovingFocusGroupDisabled", required: false }] }] } });
335
+
336
+ const [NgpRovingFocusItemStateToken, ngpRovingFocusItem, injectRovingFocusItemState, provideRovingFocusItemState,] = createPrimitive('NgpRovingFocusItem', ({ disabled = signal(false) }) => {
337
+ const element = injectElementRef();
338
+ const group = injectRovingFocusGroupState();
339
+ const focusMonitor = inject(FocusMonitor);
340
+ // genertate a unique id for the roving focus item - this is not a DOM id but an internal identifier
341
+ const id = uniqueId('ngp-roving-focus-item');
338
342
  /**
339
- * Forward the keydown event to the roving focus group.
340
- * @param event The keyboard event
343
+ * Derive the tabindex of the roving focus item.
341
344
  */
342
- onKeydown(event) {
343
- if (this.disabled()) {
345
+ const tabindex = computed(() => !group()?.disabled() && group()?.activeItem() === id ? 0 : -1, ...(ngDevMode ? [{ debugName: "tabindex" }] : []));
346
+ // Setup host attribute bindings
347
+ attrBinding(element, 'tabindex', () => tabindex().toString());
348
+ // Setup keyboard event listener
349
+ listener(element, 'keydown', (event) => {
350
+ if (disabled()) {
344
351
  return;
345
352
  }
346
- this.group.onKeydown(event);
347
- }
348
- /**
349
- * Activate the roving focus item on click.
350
- */
351
- activate() {
352
- if (this.disabled()) {
353
+ group()?.onKeydown(event);
354
+ });
355
+ // Setup click event listener
356
+ listener(element, 'click', () => {
357
+ if (disabled()) {
353
358
  return;
354
359
  }
355
- this.group.setActiveItem(this, 'mouse');
360
+ group()?.setActiveItem(id, 'mouse');
361
+ });
362
+ function focus(origin) {
363
+ focusMonitor.focusVia(element, origin);
356
364
  }
357
- /**
358
- * Focus the roving focus item.
359
- * @param origin The origin of the focus
360
- */
361
- focus(origin) {
362
- this.focusMonitor.focusVia(this.elementRef, origin);
365
+ const state = {
366
+ id: signal(id),
367
+ disabled,
368
+ tabindex,
369
+ focus,
370
+ element,
371
+ };
372
+ // Register the item when created
373
+ group()?.register(state);
374
+ // Unregister the item when destroyed
375
+ onDestroy(() => group()?.unregister(state));
376
+ return state;
377
+ });
378
+
379
+ /**
380
+ * Apply the `ngpRovingFocusItem` directive to an element within a roving focus group to automatically manage focus.
381
+ */
382
+ class NgpRovingFocusItem {
383
+ constructor() {
384
+ /**
385
+ * Define if the item is disabled.
386
+ */
387
+ this.disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled", alias: 'ngpRovingFocusItemDisabled',
388
+ transform: booleanAttribute }] : [{
389
+ alias: 'ngpRovingFocusItemDisabled',
390
+ transform: booleanAttribute,
391
+ }]));
392
+ this.state = ngpRovingFocusItem({ disabled: this.disabled });
393
+ /**
394
+ * Expose the internal id of the roving focus item.
395
+ * @internal
396
+ */
397
+ this.id = computed(() => this.state.id(), ...(ngDevMode ? [{ debugName: "id" }] : []));
363
398
  }
364
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.11", ngImport: i0, type: NgpRovingFocusItem, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
365
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.11", 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()" } }, exportAs: ["ngpRovingFocusItem"], ngImport: i0 }); }
399
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: NgpRovingFocusItem, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
400
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.3.9", type: NgpRovingFocusItem, isStandalone: true, selector: "[ngpRovingFocusItem]", inputs: { disabled: { classPropertyName: "disabled", publicName: "ngpRovingFocusItemDisabled", isSignal: true, isRequired: false, transformFunction: null } }, providers: [provideRovingFocusItemState()], exportAs: ["ngpRovingFocusItem"], ngImport: i0 }); }
366
401
  }
367
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.11", ngImport: i0, type: NgpRovingFocusItem, decorators: [{
402
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: NgpRovingFocusItem, decorators: [{
368
403
  type: Directive,
369
404
  args: [{
370
405
  selector: '[ngpRovingFocusItem]',
371
406
  exportAs: 'ngpRovingFocusItem',
372
- host: {
373
- '[attr.tabindex]': 'tabindex()',
374
- },
407
+ providers: [provideRovingFocusItemState()],
375
408
  }]
376
- }], propDecorators: { onKeydown: [{
377
- type: HostListener,
378
- args: ['keydown', ['$event']]
379
- }], activate: [{
380
- type: HostListener,
381
- args: ['click']
382
- }] } });
409
+ }], propDecorators: { disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "ngpRovingFocusItemDisabled", required: false }] }] } });
383
410
 
384
411
  /**
385
412
  * Generated bundle index. Do not edit.
386
413
  */
387
414
 
388
- export { NgpRovingFocusGroup, NgpRovingFocusGroupToken, NgpRovingFocusItem, injectRovingFocusGroup, injectRovingFocusGroupState, provideRovingFocusGroup, provideRovingFocusGroupState };
415
+ export { NgpRovingFocusGroup, NgpRovingFocusGroupStateToken, NgpRovingFocusGroupToken, NgpRovingFocusItem, NgpRovingFocusItemStateToken, injectRovingFocusGroup, injectRovingFocusGroupState, injectRovingFocusItemState, ngpRovingFocusGroup, ngpRovingFocusItem, provideRovingFocusGroup, provideRovingFocusGroupState, provideRovingFocusItemState };
389
416
  //# sourceMappingURL=ng-primitives-roving-focus.mjs.map